-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
writeStats seems to miss some generated classes and IDs #7161
Comments
Thanks. I tried to stay on the right side of false positives, but one never knows... But I have tested this on some of my sites. In general I think that:
|
Thanks for your explanation. This gave me an idea and, so far, it checks out: the tags and classes that are missing have some Hugo interpolated variables as an attribute. For instance: <form id="staticman-form" method="post" action="{{ .Site.Params.staticman.api }}">
<a href="{{ $termUrl }}/" class="term category" rel="tag"> I suppose it is possible the curly braces may mess with the |
No, this is done on the final output , so those braces are gone. That was one of the motivations behind this, to also catch classes etc. generated by the templates. |
I quickly tested your site, but get lots of build ERRORs, which could explain missing stuff ...? |
That's surprising. I don't have any build mistake (I work on two separate computers and use Gitlab CI too). I usually use Maybe you could copy the errors? |
... yes, "npm run build" builds it successfully. I assumed too much. I will look into this later. |
OK, I have run your site and I can find all of the "missing" classes and IDs you mention in the first post. Hmm.... |
I was not able to find a pattern for this issue, but I can point to some examples: The class |
@regisphilibert but your link give me a 404. |
Arf, I thought it was public. Will try and spin up a test repo for you today. In the mean time, in the off chance it might help, here's the content of that template file (culprit line is in the
|
Are you really sure the "else clause" is ever invoked? Note that the "class list" is built in the content in /public -- not your templates. |
Yep. The repo's now public, Webpack is not hooked on |
I take a closer look at the source code see if there are some obvious reason why this works for me and not for you, the code in question should be rather simple. Can I ask the people in this thread what OS you run with? |
Hold on, I'm seeing px-3 now in my |
@bep I discovered the issue on Ubuntu and tested again this morning on Windows 10. |
I assume your build is without ERRORs? |
If you're asking me, yes it is without ERRORs. |
OK, now I have seen it myself on one of my sites on Netlify, so I at least know it's real. I'll try to fix it. |
... but I built that same site on my MacBook 200 times without any diffs. Hmm... |
OK ... so I found the culprit, I think. I can reproduce this with @regisphilibert 's site when running with |
Seems promising, @bep! I tried removing the |
Yes, I found the code logic flaw. The minfier is stripping quotes in hrefs so the home link turns into this: <a class="text-base hover:text-gradient inline-block px-3 pb-1 rounded lowercase" href=/></a> Which looks like a closing tag for my naive parser, so I just drop it (in retrospect, an obvious mistake). |
Also add a related stresstest. Fixes gohugoio#7161
I'm having this same issue. Running Hugo |
This issue has been closed, if it's isolated to one template file, this look like another problem. In any case you should start detailing your problem on the discourse and share a repo or more details there if you can. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The
writeStats
feature and the contributing docs are awesome. Thanks a lot!However, it seems that it misses some IDs and classes. I have yet failed to identify a pattern in the missed objects. PurgeCSS works fine but removes classes that are needed by the layout.
So far, it seems that the missing IDs and classes do not come from any .Content, only from layouts.
I have noticed, for instance, that classes
.term
,.tag
and.category
are missing (in my layout, they're used in conjunction, as inclass="term tag"
andclass="term category"
).I also miss the ID of my comment form (
#staticman-form
), though classes specific to that form are being detected (.replying-title
).I'm sorry to say that, as I don't see a pattern, I don't know how to reproduce or build a minimal case.
The sources for the website I use Hugo with are available at https://gitlab.com/keyboardplaying/keyboardplaying.org/ (branch develop is using Hugo 0.69).
The minimal approach to reproducing would be:
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes (using the latest version)
The text was updated successfully, but these errors were encountered: