Skip to content
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

page_header template hook is not activating when set in theme file #3706

Open
soapergem opened this issue Aug 9, 2023 · 1 comment
Open
Labels

Comments

@soapergem
Copy link

Environment

Python Version: 3.10.7

Nikola Version: 8.2.4

Operating System: Windows 11

Description

I'm new to Nikola and have been simultaneously trying to follow both the Creating a Site (Not a Blog) guide as well as the Creating a Theme guide. I want to be able to override the page_header template hook specifically on my index page, within my custom theme, but am running into a lot of trouble. I based my theme off the default Mako one, per the guide.

The first thing I did was copy the index.tmpl file using nikola theme -c index.tmpl. Then I tried adding the following block definition to it:

<%block name="page_header">
    ${parent.page_header()}
    Test content
</%block>

However, my test content string doesn't show up anywhere when I run nikola build. Is there something I'm missing?

@soapergem soapergem added the bug label Aug 9, 2023
@Kwpolska
Copy link
Member

Kwpolska commented Aug 13, 2023

Template hooks are usable only from within plugins. There is a template block for the header, but it’s named extra_header, not page_header.

Also, note that index.tmpl affects blog indexes, it won’t change the index page if you’re going that route. For that, you would need to apply a special template via the PAGES config setting, or override page.tmpl and check if the post variable is the index page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants