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

W3C validator warning on the internal GA templates: The type attribute is unnecessary for JavaScript resources #6379

Closed
grrseguin opened this issue Sep 30, 2019 · 6 comments · Fixed by #11740

Comments

@grrseguin
Copy link

Hi,

I have a warning with the W3C validator: "The type attribute is unnecessary for JavaScript resources" when I use the internal template for Google Analytics.

Could you remove the type="application/javascript" attribute from the script html tag of the internal GA templates?

<script type="application/javascript">...</script> <!--Bad-->
<script>...</script> <!--Good-->

I found this if it could help you:

certainly other templates will be concerned, at least Disqus.

> hugo version
Hugo Static Site Generator v0.57.2/extended darwin/amd64 BuildDate: unknown

thank you for your work, Hugo is a great Static Site Generator!

@bep
Copy link
Member

bep commented Sep 30, 2019

The type attribute is unnecessary for JavaScript resources

Unless you somehow need it.

I think we've had this discussion before, as the minifier we use uses type to determine how to minify.

What does W3C say about this?

<script type="text/vbscript">
document.write("Hello World!")
</script>

If someone can confirm that the minifier defaults to JS for script tags, then fine.

@bep bep added this to the v0.59 milestone Sep 30, 2019
@grrseguin
Copy link
Author

grrseguin commented Sep 30, 2019

It seems that "application/javascript" is the default value for type attribute.

@jakejarvis
Copy link
Contributor

Poked around in tdewolff/minify for a few seconds and it does appear like it treats both <script type="text/javascript"> and <script type="application/javascript"> the same as <script>.

In html_test.go:

{`<script type="text/javascript">js</script>`, `<script>js</script>`},
{`<script type="application/javascript">js</script>`, `<script>js</script>`},

I could be wrong, though...

@bep bep modified the milestones: v0.59, v0.60 Oct 21, 2019
@bep bep modified the milestones: v0.60, v0.61, v0.62 Nov 25, 2019
@bep bep modified the milestones: v0.62, v0.63 Dec 11, 2019
@bep bep modified the milestones: v0.63, v0.64 Jan 22, 2020
@bep bep modified the milestones: v0.64, v0.65 Jan 30, 2020
@bep bep modified the milestones: v0.65, v0.66 Feb 18, 2020
@bep bep modified the milestones: v0.66, v0.67 Mar 2, 2020
@bep bep modified the milestones: v0.67, v0.68 Mar 9, 2020
@bep bep modified the milestones: v0.68, v0.69 Mar 20, 2020
@bep bep modified the milestones: v0.69, v0.70 Apr 8, 2020
@bep bep modified the milestones: v0.70, v0.71 Apr 28, 2020
@bep bep removed this from the v0.71 milestone May 18, 2020
@bep bep modified the milestones: v0.110.0, v0.111.0 Jan 26, 2023
@bep bep modified the milestones: v0.111.0, v0.112.0 Feb 15, 2023
@bep bep modified the milestones: v0.112.0, v0.113.0 Apr 15, 2023
@bep bep modified the milestones: v0.113.0, v0.114.0, v0.115.0 Jun 8, 2023
@bep bep modified the milestones: v0.115.0, v0.116.0 Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 4, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
jmooring added a commit to jmooring/hugo that referenced this issue Nov 25, 2023
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants