Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign Banner Photos to Articles #2264

Closed
joshfuggle opened this issue Dec 15, 2017 · 7 comments
Closed

Assign Banner Photos to Articles #2264

joshfuggle opened this issue Dec 15, 2017 · 7 comments

Comments

@joshfuggle
Copy link

Hello!

Is it possible to either:

  1. Assign a banner photo (via a static image) to an article, or
  2. Loop through all images in an article, then grab the first one for use as a banner photo in the template?

Appreciate your time in answering this.

Thanks,
Josh

@mosra
Copy link
Contributor

mosra commented Dec 15, 2017

Hi! I'm having something similar in m.css for creating jumbo articles. Basically it's about adding a new metadata field (e.g., :cover:) that the theme then has to pick up and treat as an image URL. It's a bit more involved if you want to support the internal content linking capabilities in it, there was a PR that I later converted to a standalone plugin that does so via a Jinja2 filter called by the theme.

@joshfuggle
Copy link
Author

Hey @mosra thanks so much for the tip, it has helped me a lot. The knowledge that I can arbitrarily add metadata keys has transformed pelican for me. I have added three new keys to my theme: Cover url for a cover image, CoverAlt the alt string for the image, Blurb a piece of text which is longer than Summary and can used when there is more space available on the relevant pages.
You can see my theme in action here: https://www.joshfuggle.com/

@mosra
Copy link
Contributor

mosra commented Feb 2, 2018

You're welcome :) Your theme looks super nice.

I'm still hoping that I can get the related PRs (#2196, #2260) merged to make the extra metadata more usable than now. Anybody? :D

@joshfuggle
Copy link
Author

Thanks @mosra, I am constantly changing the design, but once it is stable and I have cleaned up the code then I hope to open source it. Still got a lot of ideas to improve the overall experience. Also, since the theme expects non-standard metadata attributes you can't really just drop it in and use it immediately. This is unfortunate, but I wouldn't have achieved everything that I wanted without non-standard attributes.

@peterdesmet
Copy link
Contributor

Hi, just stumbled upon this issue for something unrelated... but I also had a need for cover images in pages/articles and created a plugin: https://github.com/peterdesmet/pelican-cover-image. Works with local and linked images + can add a default image.

@justinmayer
Copy link
Member

@joshfuggle: Were you able to find a solution to your problem here?

@joshfuggle
Copy link
Author

Hey @justinmayer, thanks for following up on this. Yes, I did indeed! Though, somewhat convoluted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants