MinchinWeb / seafoam

Pelican theme, first used for Minchin.ca.
https://blog.minchin.ca/label/seafoam/
MIT License
5 stars 2 forks source link

Update Google Analystics support #20

Closed MinchinWeb closed 11 months ago

MinchinWeb commented 1 year ago

see https://github.com/getpelican/pelican/issues/3018#issuecomment-1304772442 for sample code.

Needs to be in place for July 2023 (but really should be done sooner)

JonathanMair commented 1 year ago

Hi, is there any workaround for this in the meantime? Thanks

MinchinWeb commented 1 year ago

@JonathanMair If you're comfortable creating a pull request with the update code, I could push out a release. I haven't been able to sit down and figure this out myself yet... I do need to update my own sites soon.

JonathanMair commented 1 year ago

@MinchinWeb -- Thanks for replying. I'm sorry, when I made this comment I was thinking about Pelican itself, and I had followed a link from the page linked to above to arrive here and didn't realise this was a theme repo. Wouldn't this be better done in Pelican or a plugin rather than in a theme?

MinchinWeb commented 1 year ago

If anyone comes across this in the interim, you can add your (new) Google Analytics script to the configuration variable CUSTOM_JS_LIST (see Readme for more details, if needed).


@JonathanMair: No, the addition/update of the Google Anayltics has to be done with the theme. Part of the confusion may be coming from the fact that Pelican includes a default theme out of the box (which is what the issue you linked from is related to), but the only was for Google Analytics to run (which is a piece of client side JavaScript code) is for it to be included in the generated website, and what is generated is determined entirely by the theme -- Pelican (the engine) doesn't forceably inject anything into the geneated output.