2025年4月29日火曜日

Blogger テーマ Soho にパンくずリストを追加する

Soho Light

Add Latest Version of Schema Breadcrumbs Markup in New Blogger Theme
https://www.indiguru.info/2020/10/add-latest-version-of-schema.html
ここに載っているんですが、間違っている部分があると思われるのと、若干修正

Contempo, Emporio, Notable, Essential でも有効だと思いますが自己責任で
追記
Contempoでもok

<h3 class='post-title entry-title'> の上に
<b:include data='posts' name='breadcrumb'/> を追加

<b:includable id='commentForm' var='post'> の上に

<b:includable id='breadcrumb' var='posts'><b:if cond='data:view.isPost'> <b:loop values='data:posts' var='post'> <div class='breadcrumbs' itemscope='itemscope' itemtype='https://schema.org/BreadcrumbList'> <span itemprop='itemListElement' itemscope='itemscope' itemtype='https://schema.org/ListItem'> <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home' itemprop='item'> <meta content='1' itemprop='position'/> <span itemprop='name'><b:switch var='data:blog.locale'><b:case value='id'/><data:messages.home/><b:default/><data:messages.home/></b:switch></span></a> </span> <b:if cond='data:post.labels'> <b:loop index='nomor' values='data:post.labels' var='label'> &amp;nbsp;&#8250;&amp;nbsp; <span itemprop='itemListElement' itemscope='itemscope' itemtype='https://schema.org/ListItem'> <meta expr:content='data:nomor+2' itemprop='position'/> <a expr:href='data:label.url + &quot;?&amp;max-results=8&quot;' expr:title='data:label.name' itemprop='item'> <span itemprop='name'><data:label.name/></span> </a> </span> </b:loop> <!--<b:else/> &amp;nbsp;&#8250;&amp;nbsp; <span itemprop='name'><data:blog.pageName/></span>--> </b:if> </div> </b:loop><b:elseif cond='data:view.isPage'/> <div class='breadcrumbs' itemscope='itemscope' itemtype='https://schema.org/BreadcrumbList'> <span itemprop='itemListElement' itemscope='itemscope' itemtype='https://schema.org/ListItem'> <a expr:href='data:blog.homepageUrl' expr:title='data:messages.home' itemprop='item'> <meta content='1' itemprop='position'/> <span itemprop='name'><b:switch var='data:blog.locale'><b:case value='id'/><data:messages.home/><b:default/><data:messages.home/></b:switch></span></a> </span> <!--&amp;nbsp;&#8250;&amp;nbsp; <span itemprop='itemListElement' itemscope='itemscope' itemtype='https://schema.org/ListItem'> <meta expr:content='data:num+2' itemprop='position'/> <a expr:href='data:blog.url' expr:title='data:post.url' itemprop='item'> <span itemprop='name'><data:blog.pageName/></span> </a> </span>--> </div></b:if> </b:includable>

を追加
( 実際は <b:includable id='bylineByName' var='byline'> の上に追加されます。)
元のコードが汚いのであとで修正しようと思いますが
追記
ラベルが無い場合に投稿のタイトルが入るのでコメントアウトしました
更に追記
ページでタイトルが表示されるのをコメントアウトしました
Demo > https://s-o-h-o.blogspot.com/p/contact.html
リストタグで投稿とページのタイトル入れたのを作り直した方がいいかな
このブログでもページはパンくず入れてないので修正しようとは思ってたんですが
追記
作り直しました
[Blogger]Soho Light用パンくずリスト

追加CSS

.breadcrumbs { padding-top: 20px; padding-bottom: 0px; margin-left: 0px; padding-left: 0px; padding-right: 20px;font-size:90%; color: #000000; background: none;}.breadcrumbs a {color: #bf8b38;}@media screen and (max-width:800px) {.breadcrumbs { margin-left: 0px; padding-left: 0px; padding-bottom: 10px; padding-right: 20px; color: inherit;font-size:90%;}}.breadcrumbs a:hover { color: #bf8b38;}

(色は Soho Light に合わせてあります)

Demo > https://s-o-h-o.blogspot.com/

F(uriouz)

欲しいものリスト / 優先度の高いほしいものリスト / ☕を奢る
Donate 寄付 カンパ サポート Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
詳細プロフィールを表示

0 comments:

スパム対策の為コメントをオフにしています。
Disqusは利用出来ます。

注: コメントを投稿できるのは、このブログのメンバーだけです。

...

Recent Posts

 
"The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License."