简体   繁体   中英

Is the footer a self-contained article?

I am making the following html. Here, a colleague advised that add the article element is appropriate because the part currently enclosed in the section is self-contained by itself.

...
<footer> 
  <!-- add <article> here-->
  <section>
    <h1>heading</h1>
  </section>
  <section>
    <h1>heading</h1>
  </section>
  <!-- </article> -->
</footer>

Is it reasonable to add an article here? WHATWG says :

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, eg in syndication.

If you enclose the footer content in an article, it must be redistributable, but it will not actually be redistributed (no such api).

Also, since the footer content isn't valid unless it is within the context of other page content, it is not known whether it is self-contained.

I read this SO Q&A , but I couldn't come up with a solution on how to handle the article element. I think that it is ambiguous how far self-contained can be included. Semantics are important for SEO and accessibility, but on the other hand I suffer from this ambiguity.

Is the content of such a footer self-contained and redistributable?

This is a misuse of the <article> element and a misunderstanding of its semantics. Just because something is "self-contained" doesn't mean it should be an <article> .

This part of the spec—

...in principle, independently distributable or reusable, eg in syndication.

—means that if you shared the content of the <article> to someone else with no other context, it would make sense as a complete, standalone document by itself—regardless of if the site has a mechanism for sharing it or not.

If you can't imagine sending the text of your footer to someone in an email with the subject, "Hey, check this out," it probably doesn't belong in an <article> element.

In contrast, things that likely should be in <article> elements include:

  • Complete blog posts
  • Weather forecasts
  • Journal entries
  • Press releases
  • etc

Check out the <article> : The Article Contents element reference guide for more information.

Will you be placing this on more than 1 page? If so, you're fine. However, I did notice that you have more than 1 tag and you should never have more than 1 on your page - usually reserved for your page title - (It usually contains the keywords what you want to rank for if you care about SEO at all).

Whether or not to use inside of your footer really depends on what you are going to put in there. Usually this tag is used for content that reads like an article - a story. You could just wrap all of it in tag, but you really don't have to wrap it in anything since you've already wrapped it all in

This video shows the different HTML tags being used: https://youtu.be/1TOZWUl54ws

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM