Adding a header to the home page

16 views
Skip to first unread message

Alberto Mardegan

unread,
Sep 9, 2019, 4:19:37 PM9/9/19
to nikola-discuss
Hi there!
  I need to add a certain <link> element inside the <head> section of my homepage, but I couldn't find out how it works. For the time being I've added the header in the EXTRA_HEAD_DATA variable in my conf.py, and while it works, it is adding the header to all pages of my site. That's not a huge issue, but it would be nicer if the header was in the homepage only (and it would avoid having to rebuild the whole site whenever that link changes!).

I think there is some way to customize the header for individual pages, but in this case I don't even have a source index.md file to work with, because the index is auto-generated by Nikola. Is there any way I can achieve the goal?

Ciao,
  Alberto

Roberto Alsina

unread,
Sep 9, 2019, 4:21:15 PM9/9/19
to Nikola—Discuss
You could create a template just for that page and add a extra_head block in it.

--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/901168ce-81ae-4b95-afb3-62aaf1e77964%40googlegroups.com.

Alberto Mardegan

unread,
Sep 9, 2019, 4:36:41 PM9/9/19
to nikola-discuss
Hi Roberto!


On Monday, September 9, 2019 at 11:21:15 PM UTC+3, Roberto Alsina wrote:
You could create a template just for that page and add a extra_head block in it.

Yes, I though of creating a template for my page, but how do I apply it? I don't have a source page to apply it to, given that the index is auto-generated.

Ciao,
  Alberto 

Roberto Alsina

unread,
Sep 9, 2019, 4:39:29 PM9/9/19
to Nikola—Discuss
Hmmm. Good point. You could redo the one for all the indexes, but that's overkill.

I suspect there is no reasonable way to do it.

An unreasonable way is to replace the template for indexes and add logic inside it to only add the <link> for a single page :-(

--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages