Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling hightlight.js #131

Open
rowing-matters opened this issue Mar 22, 2018 · 5 comments · May be fixed by #135
Open

Disabling hightlight.js #131

rowing-matters opened this issue Mar 22, 2018 · 5 comments · May be fixed by #135

Comments

@rowing-matters
Copy link

Expected Behavior

I tried to disable highlight.js.
Hence I set disable_highlight = true in config.toml. But it doesn't seem to work. I expect, that the highlight.min.js is not reference in generated html.

Current Behavior

But it doesn't seem to work. I still see
<script src="//cdn.bootcss.com/highlight.js/9.11.0/highlight.min.js"></script> [...] <script>hljs.configure({languages: []}); hljs.initHighlightingOnLoad();</script> in the generated code.

Possible Solution

I guess, there's an error in line 11 of layouts/partials/footer.html:

{{ if (not .Params.disable_highlight) }}

should be

{{ if (not .Site.Params.disable_highlight) }}`

But if i correct this, I get an error "hljs is not defined". I guess the reason is line 1173 of footer.html. This should only be done "if not .Site.Params.disable_highlight".

Your Environment

Hugo Version:
Hugo Static Site Generator v0.36 linux/amd64 BuildDate: 2018-02-05T15:22:28Z

Browser:
Firefox 59.0.1
Desktop or Mobile:
Desktop

@pacollins
Copy link
Collaborator

@Jean85 made the change last time. Hopefully they can check this out.

@Jean85
Copy link
Contributor

Jean85 commented Mar 26, 2018

Yes, I fixed one thing about it in #116. @rowing-matters can you check if you're using a version of the theme that includes that fix?

@rowing-matters
Copy link
Author

Hi,
I'm on head of master. I get an identical index.html - no matter if disable_highlight is en- or disabled in config.toml.

I'm not an expert. But I think it's quite obvious, that in line 11 of footer.html the reference of the parameter is wrong.

Cheers!

@pacollins
Copy link
Collaborator

Thanks for reporting this. I am actually doubling back over the entire theme to re-base the code to be more semantic and less cluttered (in addition to utilizing CSS Grid for a more responsive layout). This is on the list.

🥂

@Colin-Parente
Copy link

I'm guessing you wanted to disable it because of its cdn being from cdnboot (super slow). One way around, which I ended up doing, was changing the cdn host to cloudflare. That boosted the sites loading time from 9 seconds to 1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants