Dynamic Tags in Custom Code of non-CMS pages

I’m trying to dynamically generate canonical tags on my non-CMS pages (I was able to do it on the CMS pages using the slug dynamic insert, this is an important thing to do for SEO).


Is there any way to do this for non-CMS pages? Is there a template language for accessing page attributes (like the slug) and dynamically inserting them into static pages? If not, does anyone have a workaround where I can pull page attributes (like slug or URL) from the page and insert them in the header?

The alternative of going through all of my pages 1 by 1 to do this does not thrill me

For this one you’re going to need some javascript: