From 92050d90bc99f65dfdcd2297d8223228a0d08367 Mon Sep 17 00:00:00 2001 From: Frederik Elwert Date: Thu, 10 Oct 2024 14:35:07 +0200 Subject: [PATCH] Add FAQ regarding theme overrides Currently, the documentation refers to creating new themes a lot. It is much less apparent how one can customize an existing theme by overriding individual templates or adding new ones. This commit adds an FAQ for this, and also mentions the mechanism in the FAQ on custom templates. --- docs/faq.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index bbf058cd5..8ae3af29b 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -64,6 +64,19 @@ How do I create my own theme? Please refer to :ref:`theming-pelican`. +Can I override individual templates without forking the whole theme? +==================================================================== + +Yes, you can override existing templates of the theme that you are using, or +add new templates, via the ``THEME_TEMPLATES_OVERRIDES`` variable. For example, +to override the page template, you can define the location for your templates +like this:: + + THEME_TEMPLATES_OVERRIDES = ["templates"] + +You can then define a custom template in ``templates/page.html``. +See :ref:`settings/themes` for details. + I want to use Markdown, but I got an error. =========================================== @@ -122,7 +135,8 @@ For content in Markdown format:: Template: template_name Then just make sure your theme contains the relevant template file (e.g. -``template_name.html``). +``template_name.html``). If you just want to add a new custom template to an +existing theme, you can also provide it in a directory specified by ``THEME_TEMPLATES_OVERRIDES`` (see :ref:`settings/themes`). How can I override the generated URL of a specific page or article? ===================================================================