Skip to content

Conversation

@imomaliev
Copy link
Contributor

Read more #14044

@CLAassistant
Copy link

CLAassistant commented Oct 12, 2025

CLA assistant check
All committers have signed the CLA.

@jmooring
Copy link
Member

Neither article nor section are semantically correct in this context. See:

Use a div element instead.

@imomaliev
Copy link
Contributor Author

imomaliev commented Oct 13, 2025

@jmooring Hi, thanks for the reply!

Neither article nor section are semantically correct in this context.
Use a div element instead.

I might be misunderstanding something, so can you please help me understand this better? Why are article and section not correct in this context?

MDN docs for article state

A given document can have multiple articles in it; for example, on a blog that shows the text of each article one after another as the reader scrolls, each post would be contained in an <article> element, possibly with one or more <section>s within.

and for section

If the contents of the element represent a standalone, atomic unit of content that makes sense syndicated as a standalone piece (e.g., a blog post or blog comment, or a newspaper article), the <article> element would be a better choice.

The home.html and section.html are clearly used for listing articles with "summary" of their text. In my understanding this exactly the case outlined in docs and should be a better fit than div.

@jmooring
Copy link
Member

Using an article element is incorrect because a summary is not a self-contained composition.

Go ahead and use section as long as you wrap both the heading and the summary.

@imomaliev imomaliev changed the title wrap .Summary in article tag to avoid tag leakage Oct 13, 2025
@imomaliev
Copy link
Contributor Author

Using an article element is incorrect because a summary is not a self-contained composition.
Go ahead and use section as long as you wrap both the heading and the summary.

But I am not wrapping .Summary by itself, I am wrapping it together with h2 for .Page.Title. I think the title was incorrect and this is why there is some missunderstaning.

I've updated title to Use article tag to wrap pages in collection rendering when using .Summary to avoid issues with tag leakage. Can you please review the code and tell me if I should it change it to section or div?

@jmooring
Copy link
Member

Go ahead and use section as long as you wrap both the heading and the summary.

Or to put it another way, don't use an article element.

@imomaliev imomaliev changed the title Use article tag to wrap pages in collection rendering when using .Summary to avoid issues with tag leakage Oct 13, 2025
@imomaliev imomaliev force-pushed the fix/wrap-summary-in-article branch from c001ce5 to 5373d5e Compare October 13, 2025 19:39
@imomaliev
Copy link
Contributor Author

Replaced article with section in code and updated the title

@jmooring
Copy link
Member

Final step... please review the commit message guidelines. It should be something like:

create/skeletons: Wrap section and home lists with section tags
@imomaliev imomaliev force-pushed the fix/wrap-summary-in-article branch from 5373d5e to c02ef77 Compare October 13, 2025 19:59
Avoiding issues with tag leakage when using .Summary
See issue gohugoio#14044 for details.
@imomaliev imomaliev force-pushed the fix/wrap-summary-in-article branch from c02ef77 to f186449 Compare October 13, 2025 20:00
@imomaliev
Copy link
Contributor Author

@jmooring I'm so sorry, missed that part when reading CONTRIBUTING.md yesterday. Thanks for your patience)

@jmooring jmooring changed the title Use section tag to wrap pages in collection rendering when using .Summary to avoid issues with tag leakage Oct 13, 2025
@jmooring
Copy link
Member

No problem, looks good, thank you for your contribution.

@imomaliev
Copy link
Contributor Author

imomaliev commented Oct 13, 2025

Wanted to leave this research for the context, not for continuing the discussion


After re-reading the spec and multiple articles 1, 2,3

The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

When used specifically with content to be redistributed in syndication, the article element is similar in purpose to the entry element in Atom. [ATOM]

A section forms part of something else. An article is its own thing. But how does one know which is which? Mostly the real answer is "it depends on author intent".

I still think article tag usage here could be considered semantically correct (when wrapping together with heading). If we are talking in the context of syndication, title + summary in collections pages like home.html and section.html may be considered self-contained composition or "independent item of content." Because one could argue that it is possible to distribute only article's intro (title + summary) as separate content. As well as in the context of using screen readers, this may be preferable to section because we are listing "repeating content units".

@jmooring
Copy link
Member

I have approved this PR as-is. I think we're done here.

@imomaliev
Copy link
Contributor Author

imomaliev commented Oct 13, 2025

I have approved this PR as-is. I think we're done here

Yes, of course. As I've stated in the previous comment, I only intended to add some information after additional research, not to continue with the discussion. You are the "author" in the context of my previous comment, so your intent is what matters))

@bep bep merged commit 29cf874 into gohugoio:master Oct 14, 2025
6 checks passed
@imomaliev imomaliev deleted the fix/wrap-summary-in-article branch October 14, 2025 11:37
imomaliev added a commit to imomaliev/blog that referenced this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants