You cannot declare the same variable twice even in a conditional context. You should declare your variable with the most common value first.
Then run your condition and overwrite it if test is passed.
Finally drop your script tag with the â $main.Permalink.
Iâd quickly post an illustrative code block for your but Iâm on mobile and lazy . If this âtext blockâis not clear enough, Iâll eventually do it for you once in front of my computer.
Yeah, I didnât notice your script tags differed (integrity), so your piece of code is almost right. You have to remember that while := is used to assign a value to a new variable, = is used to assign a value to an existing one. By using := twice on the same variable, you are in effect declaring it twice.
You can check this example at the bottom of this section from the referred piece.
Your corrected code blocks (= instead of := on the second assignment) should work fine:
However, it still doesnât work. In fact, all code blocks mentioned here outputs a (in appearance) well processed main.js (concatenated, minfied, etc.) and itâs accessible at (root)/main.js after build,so the piping seems ok, but it seems the result is not âtaken into accountâ so to speak, and another weird side effect is all inline javascript (for example the contact button with âonclickâ function, in nav partial) isnât working any more.
So I guess the problem doesnât come directly from script piping. Do you have an idea where it could come from? Can you reproduce this behaviour locally?
Yet I donât have a complicated dependencies bundle, itâs a very simple website, I donât know what could interfereâŠ
The build message seems ok:
λ hugo server -D -verbose
INFO 2019/01/03 17:45:48 No translation bundle found for default language "fr"
INFO 2019/01/03 17:45:48 Translation func for language fr not found, use default.
INFO 2019/01/03 17:45:48 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
INFO 2019/01/03 17:45:48 Using config file:
Building sites ⊠INFO 2019/01/03 17:45:48 syncing static files to (***)\inwardmovement.github.io\
INFO 2019/01/03 17:45:48 No Static directory found
INFO 2019/01/03 17:45:48 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2019/01/03 17:45:48 Alias "/poems/" translated to "poems\index.html"
| FR
+------------------+-----+
Pages | 306
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 326 ms
Watching for changes in (***)\inwardmovement.github.io\{assets,content,layouts}
Watching for config changes in (***)\inwardmovement.github.io\config.yml
Environment: "rbose"
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
For me, the only problem is a comment in your app.js which once part of a concatenation throws a js error (Uncaught SyntaxError: Unexpected identifier). I removed this form the top of app.js:
/************************************************************
TOP BUTTON
************************************************************/
and everything worked fine. On my local at least. I could not test the site with minify etcâŠ
Maaan thank you, it works as expected now!
I should have checked the console, beginnerâs mistake, my badâŠ
Just to clarify things (I think the documentation is not exhaustive on this point): why an .IsServer check is required for <script>s and not for <style>s? What is it useful for, Is it really mandatory?
And yeah, it seems to me a lot of french speaking people are using Hugo out there ^^
Thank you @regis that totally did the trick! It was printing ânotesâ for every page and I realise thatâs because I was trying to render a cached partial, like this:
{{ partialCached "footer.html" . }}
But clearly that prevents the condition from working.
So I switched back to a regular partial, like this:
{{ partial "footer.html" . }}
And weâre back in business. Works just as expected.