tlienart / Franklin.jl

(yet another) static site generator. Simple, customisable, fast, maths with KaTeX, code evaluation, optional pre-rendering, in Julia.
https://franklinjl.org
MIT License
963 stars 114 forks source link

Support for Google Analytics #554

Closed y1my1 closed 4 years ago

y1my1 commented 4 years ago

Hi Thibaut,

Thanks for your work on this terrific package.

I don't see any issues related to Google Analytics. I switch from Academics theme in Hugo to Franklin. I see there Google Analytics is supported using gtag.js. I am wondering if there is some support for using Google Analytics now. Or maybe you can give me some guidance of how to set this up.

Thanks in advance for your help.

tlienart commented 4 years ago

Hello, if I’m not mistaken you’ll get GA support just by dropping a few lines of JavaScript in the _layout/head.html; see for instance the JuliaLang.org repo where that file (or one of the neighbouring file) has the GA stuff (no more than 5 lines IIRC which just indicate an ID number)

Let me know if that doesn’t work for you!

tlienart commented 4 years ago
<script type="application/javascript">
    var doNotTrack = false;
    if (!doNotTrack) {
        window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
        ga('create', 'UA-28835595-1', 'auto');
        ga('send', 'pageview');
    }
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

See _layout/head_scripts.html in that repo

tlienart commented 4 years ago

Ps: let me know how the move from academic theme goes please; I’d like to port that to a FranklinTemplate soon but there’s one thing Franklin is missing at this point: pagination; this should be in soon...

As far as I know this is the main thing missing, the rest should be doable

y1my1 commented 4 years ago

Awesome. It works very well.

For your question about the move from the academic theme, it went quite smoothly since what I have and need are quite basic. I just ported your personal website and modified the CSS theme for a few places. You may have a look at my academic website here.

Thanks a lot for your help.

tlienart commented 4 years ago

very nice, I like the folding abstract! (you might want to use a slightly different font or font colour to distinguish the content).

great stuff and glad that GA works well for you :+1:

tlienart commented 4 years ago

ah and @JackRab you will want to change the favicon (currently it's the default red question mark)

Screenshot 2020-07-15 at 17 46 17

y1my1 commented 4 years ago

Yes, actually I like the default question mark favicon. It seems to me quite conform with the academic purpose.

Thanks for your suggestion about font settings. I'd like to adjust them at some time.

I don't know if this is related to Franklin.jl but I guess you know better than me. I would like to have lines rendered with equal width just like what LaTeX does. Like in this

image

instead of

image

I wonder if this is easily possible with Franklin. Thanks for your comments.

tlienart commented 4 years ago

You can look up “justified text with CSS” and you can set it in your CSS file; note that using justified text online is discouraged as it can be very ugly in some settings (for latex everything is super optimised for one page size but on web you could have any page size and the browser has to reflow the text accordingly)

https://designforhackers.com/blog/justify-text-html-css/

y1my1 commented 4 years ago

I see. Thanks.