-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Blog: Hero images #6745
Comments
Thanks for suggesting. Duplicate of #5736 (and some other issue I currently can't find). Please use customizations to include thumbnails in posts. It's likely that we eventually add this functionality, but we're still in the collection stage of requirements, so native support for this is not planed yet. It is, however, quite easy to do this functionality yourself. You can post also ask for more support on our discussion board. |
That was my fault for not looking for the prior discussion of this (I suggested the FR). @squidfunk, how about I show how this can be done in the blog example that I need to pick up again? I'll post the necessary snippets here. @mathisgauthey, do you think it would be ok to have to put the image URL/path into the post meta-data? That is the most flexible option, I think, but requires some work by the post author. |
I think it could be a great start thanks ! One could then think about having a default behavior for handling thumbnails on modified Blog index pages such as using the first image found in the post or reverting to the social card of the post if the plugin is activated. |
You know what, we'll reopen it, as this has been asked for a few times, so we'll see if others would find it useful as well. We could add functionality that extracts the image and allows for overriding via meta data, but I need to investigate. I'll try to come up with a general solution for this, but in the mean time the absolute simplest solution is #5406 (comment).
IMHO, it's a hero image, not a thumbnail 😉 Using the social card image is not really a good idea, IMHO, because it has a completely different purpose. Thus, I'd say:
We could also allow to explicitly unset the image by using something like |
Definitely interested too! For now, I'm using a custom template to achieve this but not relying on blog plugin. |
I have a simple solution which works for me now. No doubt it can be improved much but it does the job. Some things are hardcoded but this can be changed by someone with much more dev skills. I must confess I used ChatGPT with a lot of prompts but hey, if it does the job... In my case, only the home page must have a hero image. It needs to cycle every 4s between 4 available images with a fade effect. The frontmatter of the home index.md page
I override the home.html page with this code:
|
Context
I'm coming from Hugo with the theme hugo-theme-stack. Here's a demo page using it that looks like my old setup.
That's a blog template, with images for each posts.
@alexvoss recommended that I submit a feature request here.
Description
I'd like the blog index page to search for the first image linked inside the markdown document and use it as a thumbnail. That would allow for beautiful and easy projects portfolio inside blogs from mkdocs-material. But also a colorful blog index.
One could also overwrite it using a
thumbnail:
YAML key that gives the path to a file.A default value could be the social card for that particular link maybe ?
Here's an example of my old theme :
Here's my current theme using mkdocs-material :
Related links
Use Cases
Apparently I wasn't the only one to ask for such a feature.
The image would allow us to build beautiful blogs without hassles, using the already existing blog chronological index. And we could also use it for generating projects portfolio index files automatically.
Visuals
Add the image above or below the blog post in a rectangular container, maybe ? Or just a thumbnail on the left of the blog post in the index file.
Before submitting
The text was updated successfully, but these errors were encountered: