Add headers h1, h2, h3 (Contempo)

馋奶兔 提交于 2019-12-13 08:19:19

问题


Help I need to implement header H1, H2 and H3 correctly in blogspot theme "Contempo", issue just released a week ago, approx. March 20, 2017. (Tema contempo)

By default comes H3 for the title of the post

<h3 class='post-title entry-title'>
   <b:if cond='data:post.link or (data:post.url and data:view.url != data:post.url)'>
      <a expr:href='data:post.link ?: data:post.url'><data:post.title/></a>
   <b:else/>
      <data:post.title/>
   </b:if>
</h3>

And I need for better SEO to implement

H1 title of article H2 internal subtitle of the article H3 subtitle of article

I have implemented this code

<b:if cond='data:blog.pageType == &quot;index&quot;'>
   <h2 class='post-title entry-title'>
     <b:if cond='data:post.link or (data:post.url and data:view.url != data:post.url)'>
       <a expr:href='data:post.link ?: data:post.url'><data:post.title/></a>
     <b:else/>
       <data:post.title/>
     </b:if>
   </h2>
<b:else/>
   <h1 class='post-title entry-title'><data:post.title/></h1>   
</b:if>

But I get: H1 blog name H1 article name

And I think there should not be 2 H1 in the home, so something is poorly implemented

Another thing the Contempo theme brings a prominent entry and this is shown in the home as H3


回答1:


You're right that the page should not contain two h1 elements.

Go to Header1 widget in your template and replace this:

<b:include name='super.title'/>

With:

<b:if cond='data:view.isSingleItem'>
  <h2 class='title'>
    <a expr:href='data:blog.homepageUrl'>
      <data:title/>
    </a>
  </h2>
<b:else/>
  <h1 class='title'>
    <a expr:href='data:blog.homepageUrl'>
      <data:title/>
    </a>
  </h1>
</b:if>


来源:https://stackoverflow.com/questions/43148424/add-headers-h1-h2-h3-contempo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!