Add global code & meta tags to header or footer

Todays web design demands that I be able to add code to my pages at certain places, like in the head tag, or at the very end of the page. Blocs doesn’t handle this too well. There is a feature to add code to a single page and then choose either header or footer, but if I want to add a global code (cookie consent, script for a chat service, etc.) I pretty much have to do it by hand - esp. if I want the code to go at the end.

At the moment I am misusing the “Analytics Code” setting in the global site settings to add a whole bunch of other code besides just analytics. It works OK, but it’s kind of a hack.

So my wish is:

  1. Global Code: add code to either the head or at the end on a global basis for every page on a site.
  2. Global Meta: be able to add meta tags like keywords on a global basis for every page on the site.

The single page code setting should remain - that way I can still add a script that is specific to a certain page.

1 Like

You could add all the code you wish globally by adding a code bric into the global area of your page - this should then transfer to every page you add. Doing it this way, you can set where in each page the code should be placed (header, footer, before doctype etc.) Not actually tried it, but worth trying.

1 Like

You can use a code bric, then select Project header or footer from the drop down option in the code editor.

3 Likes

Yea, but that’s still on a page to page basis, right?

Nope project settings are for all pages. Page settings are page by page

1 Like

Ok that’s a workaround. I will still add a wish to the wishlist for this to be a feature in the site settings. Just seems the logical place to put it, esp. when you consider that there is already a feature for adding “analytics” …

1 Like

Agreed. For now, I too just use Analytics Tracking Code in the Project Settings because it is faster and easier than adding an HTML widget. Speed is everything.

By the way, that field in Analytics Tracking Code is a minor bother because when Return closes Project Settings. The good news is that if you press Option-Return, you’ll get a new line. Even so, having a built-in feature would be welcomed. Or maybe rename “Analytics Tracking Code” to “Global Code”? Anyway, I’m surprised I alone hearted❤️ this great Wish List request.

1 Like