How can I override the default template used by a page or article in pelican?
Asked Answered
J

2

9

I would like to know how can I use a different template for a page or article in pelican?

So far, it seems that for articles is using article.html and for pages page.html.

Jimerson answered 31/8, 2013 at 17:37 Comment(0)
L
9

You can set the output filename by using the Template metadata in your individual files. This will override the default that you set in your configuration file.

For Markdown you would include this in your header:

 Template: template_name

This is discussed in the FAQ on the pelican website.

Libna answered 1/1, 2014 at 17:38 Comment(0)
M
1

Pelican looks for templates in whatever directory you've specified as THEME in your pelicanconf.py. If you just want to change what the output looks like, you can modify article.html or page.html in that directory (the default is themes/notmyidea relative to wherever pelican is installed). See how to create themes for Pelican for more.

If you actually want to change the name of the file that Pelican looks for to generate the articles or pages, that's a bit trickier. I don't know of any setting that allows this to be altered, but the relevant bit of the Pelican source appears to be here, so if you really want this you could consider subclassing Content yourself of just changing the relevant lines in your copy of Pelican.

Marius answered 31/8, 2013 at 22:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.