pelican icon indicating copy to clipboard operation
pelican copied to clipboard

Accessing files included with an article

Open daturkel opened this issue 2 years ago • 2 comments

  • [x] I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • [x] I have searched the documentation and believe that my question is not covered.

Issue

I'd like my index template to be able to be able to include a specified image from each post.

In my article, I include foo.jpg somewhere and it winds up in myurl.com/2022/06/13/foo.jpg and shows up in my blog post just fine.

However, I'd like to be able to set header_image: foo.jpg in the article metadata, and then be able to link to the fully resolved URL in order to include that image in the index page. The closest I've come up with is including is rebuilding image URL in the index template as as SITEURL + article.date|strftime("%Y/%m/%d/") + article.header_image, but this feels somehow inelegant and would break if I were to ever change my URL structure for some reason.

Is there a better way for me to be able to say "foo.jpg located in the same folder as the article.url"?

daturkel avatar Jun 13 '22 23:06 daturkel

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your participation and understanding.

stale[bot] avatar Aug 13 '22 10:08 stale[bot]

@justinmayer is there an easy way to do this?

daturkel avatar Aug 16 '22 15:08 daturkel