简体   繁体   English

页脚是独立的文章吗?

[英]Is the footer a self-contained article?

I am making the following html.我正在制作以下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.在这里,一位同事建议添加 article 元素是合适的,因为当前包含在 section 中的部分是独立的。

...
<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 : WHATWG

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. article 元素表示文档、页面、应用程序或站点中的完整或自包含的组合,也就是说,原则上,可独立分发或可重用,例如在联合中。

If you enclose the footer content in an article, it must be redistributable, but it will not actually be redistributed (no such api).如果将页脚内容包含在文章中,则它必须是可重新分发的,但实际上不会重新分发(没有此类 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.我读了这个 SO Q&A ,但我无法想出如何处理文章元素的解决方案。 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.语义对于 SEO 和可访问性很重要,但另一方面,我也遭受这种歧义的困扰。

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.这是对<article>元素的误用和对其语义的误解。 Just because something is "self-contained" doesn't mean it should be an <article> .仅仅因为某些东西是“自包含的”并不意味着它应该是一个<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. — 意味着如果您将<article>的内容分享给没有其他上下文的其他人,则它本身就可以作为一个完整的独立文档有意义 — 无论该站点是否具有共享它的机制。

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.如果您无法想象通过电子邮件将页脚的文本发送给某人,主题是“嘿,看看这个”,那么它可能不属于<article>元素。

In contrast, things that likely should be in <article> elements include:相比之下, <article>元素中可能应该包含的内容包括:

  • Complete blog posts完成博客文章
  • Weather forecasts天气预报
  • Journal entries日记帐分录
  • Press releases新闻稿
  • etc等等

Check out the <article> : The Article Contents element reference guide for more information.查看<article> :文章内容元素参考指南以获取更多信息。

Will you be placing this on more than 1 page?您会将此放在 1 页以上吗? 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).但是,我确实注意到您有超过 1 个标签,并且您的页面上永远不应有超过 1 个标签 - 通常保留给您的页面标题 - (如果您完全关心 SEO,它通常包含您想要排名的关键字)。

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此视频显示了使用的不同 HTML 标签: https : //youtu.be/1TOZWUl54ws

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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