-
-
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: embed blog posts in other pages #5074
Comments
good idea, I think I'd love the same functionality but expanded with tags, not only categories |
I support this as well. My use case is to feature some blog posts on the main |
Awesome! Best way to show your support is using reactions – just upvote |
This functionality will be implemented as part of the new tags plugin. We've already got a first alpha over at Insiders which basically lays the groundwork for this feature request and has massive new capabilities. If you're on Insiders, you can already test it! You can tag the blog articles that you want to include in a listing with a tag, and then create a listing with that tag: plugins:
- tags There's no more need to specify the index via ### Newest blog posts
<!-- @tags latest --> This will include all blog posts that are tagged with the plugins:
- tags:
tags_property_name: hidden_tags This will render the tags index, but won't include those tags in the blog post. Note that the tags plugin is now also multi-instance capable, so you can use one instance for tags, and one for latest blog posts. I understand that this is still a little inconvenient, but it will get simpler in the near future. Before we're considering this issue resolved, we will add the following capabilities:
This will also allow to link blog posts in a "suggest next reading" carousel at the end of a post, which is another nice functionality that we're considering adding. We're getting there! |
By the way, all sponsors can help us test the plugin and give feedback in #6517 – it should already be reasonably stable, I've squashed many bugs yesterday and today. I'm confident that we'll push it into production in the coming 2 weeks, including adding documentation and some easily runnable examples. |
Context
I'm using Mkdocs Material in three projects. Two internal documentation and a personal website that will present my side projects and share my passion towards IT generally. All those three websites will use the blog plugin.
Description
The goal of this feature would be to allow embeding the N last posts of a blog category on any page.
Markup
The idea would be to use a markup that will be parsed by the theme. To be consistent with the
<!-- more -->
syntax for the excerpts, it could look like this:<!-- blog:category_name nbPosts -->
, ex:<!-- blog:feature 5 -->
to embed the last5
posts belonging to thefeature
category.Note: the syntax
<!-- blog 5 -->
could be considered valid, and just embed the last5
blog posts.Data in partials/templates
For more flexibility, providing the post data indexed by categories in partials and templates would be very useful too:
{% for post in blog.categories.category_name %}
, ex:{% for post in blog.categories.feature %}
to loop over thefeature
category posts.As a mirror of the markup solution, all posts would be available in
blog.posts
.Related links
Use Cases
As authors, we can just embed any number of posts from any category with a one-liner, on any page and maybe two or three times on the same page, depending on our use cases.
We don't have to bother anymore with keeping these lists up to date.
Benefits overview
Drawbacks
Don't see anything that would break. Should not require too much work. The articles would be displayed as they currently are on the blog index/category index. If any further customization is needed, the ability to use the data provided to partials and templates would allow displaying them the way we want.
Visuals
No response
Before submitting
The text was updated successfully, but these errors were encountered: