tlienart / FranklinTemplates.jl

Simple website templates for Franklin.jl
https://tlienart.github.io/FranklinTemplates.jl/
MIT License
76 stars 24 forks source link

Changing title on Vela theme doesn't change tab information #138

Closed YanniPapandreou closed 2 years ago

YanniPapandreou commented 2 years ago

Hi,

I have been experimenting with the Vela theme for Franklin and I notice that if I change the @def title = "My Title" at the top of the index.md file this does not change the browser tab information which still prints out "Franklin Example | Vela". Changing the title on the sandbox template does cause the browser tab to change. How can I do this in Vela?

tlienart commented 2 years ago

Hello @YanniPapandreou ,

In the _layout folder you'll see the <title> part (see here: https://github.com/tlienart/FranklinTemplates.jl/blob/e14b3a27c2997dbcefb0d5a107dc2bfe7b9edbb8/src/templates/vela/_layout/head.html#L11 but it's reproduced in your folder at _layout/head.html)

You'll see here that it's fixed to "Franklin Example | Vela"; if you want it to be controlled by each page, you could replace this by

<title>{{title}}</title>

what this will do is that it will check the page variable title for each page; note that this requires the title page variable to be defined on all pages.

If you want to use a "default" title that gets used whenever title is not specified on a page, you can assign title = "The Default Title" in your config.md.


PS: @def ... is being deprecated in favour of +++ ... +++ blocks so prefer for instance

+++
title = "Hello"
some_other_var = 25
+++

to

@def title = "Hello"
@def some_other_var = 25

the effect is the same (and you can have multiple +++ blocks on a page if that's useful to you.

YanniPapandreou commented 2 years ago

Hello @tlienart thanks a lot for getting back to me so quickly! This fixed the issue for me :)

tlienart commented 2 years ago

Cool, good luck and hi to Andrew ;-)

YanniPapandreou commented 2 years ago

Thanks, I will do!