All posts

How to use images in NimblePublisher posts

As of this writing I am using Phoenix and NimblePublisher to write these posts. To load images in these posts I use image tags that point to this path in my application directory: my_app_name/assets/static/images/blog/:year/:month/:image_file.

And the image tag in the *.md posts will use the relative path to the image file and that looks like: <image src="/images/blog/my_picture.png" alt="my_picture" />.

Or using markdown: ![alt my_picture](/images/blog/2020/december/my_picture.jpg)

Explicit example in a post:

  title: "How to add post scheduling to NimblePublisher",
  description: "Learn how to schedule posts using NimblePublisher",
  tags: ~w(elixir Phoenix CMS),
<image src="/images/blog/my_picture.png" alt="my_picture" />

It took me some time to get the routing right for images when I was building this CMS. I hope you found this to be useful.


I built two products to help fund continued efforts for this website, it would mean a lot if you would check them out:
1. 2500+ Words for the Undermotivated Software Engineer - A short essay I wrote on the titled topic ($3).
2. Build 3 Chrome Extensions in Under 2 Hours - A course I built to teach chrome extension development ($9-20).