html - 使用 <section> 和 <article> 进行 SEO 的正确方法

标签 html seo

如果我拼错了,请原谅我,请更正。
我不知道如何使用这两个元素( Article | Section )
现在我想启动一个具有完全标准 HTML 代码的站点,
现在,您认为我网站上的文章应该如何组织?我在哪里可以更好地放置站点标题?
我被困在这两个选项之间。

<!-- 1 -->
<section>
    <header>
        <h1>title of page</h1>
    </header>
    <article>
        <p>some text</p>
    </article>
</section>

<!-- 2 -->
<section>
    <article>
        <header>
            <h1>title of page</h1>
        </header>
    </article>
    <p>some text</p>
</section>
如果两者都不正确,您有什么建议?
我的英文很差。所以我不能再使用任何问题了。但我理解编码。请写代码和简单的句子给我解释,不要说你的问题有答案。

最佳答案

阅读有关 的更多信息HTML element article Mozilla 的:

The HTML element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication)... each post would be contained in an element, possibly with one or more s within.


不像article元素, section element :

The HTML element represents a generic standalone section of a document, which doesn't have a more specific semantic element to represent it.


因此,article 元素可以包含 section 元素。但是section element 不能包含任何其他语义元素。
因此,您的示例可以如下所示:

<header>
 <h1>The article News from Valinor of Gandalf</h1>
</header>
<article>
  <h2>News from Valinor</h2>
  <p>A short introduction to the content of the article.</p>
  <section>
    <h3>The name of section</h3>
    <p>The content of section.</p>
  </section>
  <section>
    <h3>The name of section</h3>
    <p>The content of section.</p>
  </section>
  ...
</article>
<footer>
 <h2>Publisher and copyright holder</h2>
 <p>Publisher and © 2021 Gandalf</p>
</footer>

关于html - 使用 <section> 和 <article> 进行 SEO 的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69222379/

相关文章:

php - 半静态/动态页面

seo - 不要点击页面上的链接

wordpress - 更改 Wordpress 站点中的 robots.txt 文件导致 SEO 困惑

html - 如何在水平和垂直侧边栏之间放置间距

html - CSS 菜单中的箭头在 float 时未正确排列

Javascript 跨越内容,设置文本(),还原

javascript - HTML5 视频标签中的提示点

seo - 为什么 Googlebot 按 URL 长度的升序遍历新添加的站点?

seo - seo修改多久生效?>

javascript - 在 "a href"元素上触发点击事件