-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Featured images shared between posts #866
Comments
Hugo's new resource system (which we use for featured images) does not currently work with images in the
I believe it's on their roadmap to remove the limitation. If you are using an OS which supports symlinks, such as Mac or Linux, then you may be able to create symlink shortcuts to your image rather than duplicate it. Alternatively, the header image can be used (which works with images in the Hope that helps. |
I figured out a way to work around the /static folder limitation for sharing resources between multiple posts, so I thought I share it. I created a headless-bundle in the /media directory, which allows anything put under that directory to be used as resources with Hugo's new resources system. Next I changed the partials that pick up the resource from the featured image, to pick the resource specified with a src parameter of the image, if it exists, e.g.: [image]
src="sharedfeaturedimage.png" If there is no such resource specified the featured image works as in the default case. The headless-bundle under /media can also be used to hold any image, not just the featured ones, that would be available for image processing without potentially duplicating them for articles. I think this is a pretty solid solution to enable shared resources, especially featured images, between multiple posts. The biggest change required is changing all the partials to make use of the /media directory. I could create a pull request for the changes, as I feel like the solution would work for others in a similar situation. |
Is there a way in hugo-academic to use the same featured image for multiple posts without actually duplicating the image? In previous versions, I could just give the relative link to the file in static/img for this. Unless I missed something, in the new resource system I feel like this image has to be always located/found in the directory of the post under the "featured.jpg" or "featured.png" name.
Something like an optional:
[image]
src="sharedfeaturedimage.png"
that would take the featured imagine from the static/img directory, would be really helpful.
The text was updated successfully, but these errors were encountered: