Skip to content

How to Customize the Archive Page for a Blog Plugin #6324

Answered by squidfunk
shenweiyan asked this question in Q&A
Discussion options

You must be logged in to vote

This, or you can even set another template for archive pages and provide your own template. The blog plugin uses the same mechanics as the rest of Material for MkDocs: simple Jinja2 templating. I haven't tested it, but you should be able to do something like this using MkDocs' hooks:

from material.plugins.blog.structure import Archive
def on_page_markdown(markdown, *, page, config, files):
    if isinstance(page, Archive):
        page.meta["template"] = "my-custom-template.html"

Replies: 1 comment 6 replies

Comment options

alexvoss
Nov 13, 2023
Collaborator Sponsor

You must be logged in to vote
6 replies
@squidfunk
Comment options

Answer selected by shenweiyan
@shenweiyan
Comment options

@squidfunk
Comment options

@shenweiyan
Comment options

@squidfunk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants