Checked links to static content

I have various images in my static directory that I’d like to refer to from markdown content, but I haven’t found a great way of doing it. Let’s say my base_url is https://example.com/user/me and I want to refer to static/pic.jpg.

  • I can link it with a relative path, like ![Pic](../../pic.jpg). This has the problem that I need to update the link when I move the markdown file.
  • I can link it with an absolute path, like ![Pic](/user/me/pic.jpg). This has the problem that I need to update the link when base_url changes. (It’s also the solution that was mentioned in this similar issue)

Besides being a little fragile, the options above don’t check that the link is valid. I tried some variations on ![Pic](@/pic.jpg) but couldn’t get any to work. Is there a better option that I’m missing?

Currently it’s not checking from the markdown directly. You can use a shortcode and use the get_url and it should check for presence. Not ideal though.

1 Like