Modifying head_tag.html template

Thanks for clarifying.

What you want to do is actually possible in a theme. I initially thought you were trying to modify the existing tags in the document <head> tag that are added by Discourse.

A theme can add arbitrary tags to the document <head> tag without issues. That’s the purpose of the head_tag.html file that the Theme CLI generates.

The head_tag.html file correlates to the </head> tab in the theme editor

Any valid html you add there will be injected in the document <head> tag. Notice that I said injected - you don’t override the existing tags, your html just gets added to them. It would be added here (simplified screenshot)

So if you want to add a <link> tag for a font like this one for example

<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

you would just need to add it to the head_tag.html file that the Theme CLI generates and it should show up. (simplified screenshot)

Do note that unlike CSS changes, this requires a page refresh to actually work.

Let me know if you need any clarification.

「いいね!」 9