Blogger変数一覧

Bloggerのテンプレートを変更する場合に必要な各ページごとの変数の一覧です。
検証に使ったページ Blogger標準javascriptのログ一覧

ページ種類url例
トップページhttps://googlebloggertrouble.blogspot.com/
トップページ2ページ目https://googlebloggertrouble.blogspot.com/search?updated-max=2019-04-24T00:00:00%2B09:00&max-results=10
投稿https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html
ページhttps://googlebloggertrouble.blogspot.com/p/sitemap.html
ラベルページ(SEO対策)https://googlebloggertrouble.blogspot.com/search/label/SEO%E5%AF%BE%E7%AD%96
ラベルページ(SEO対策)2ページ目https://googlebloggertrouble.blogspot.com/search/label/SEO%E5%AF%BE%E7%AD%96?updated-max=2019-04-21T00:00:00%2B09:00&max-results=20&start=20&by-date=false
アーカイブ年https://googlebloggertrouble.blogspot.com/2021/
アーカイブ年月https://googlebloggertrouble.blogspot.com/2021/05/
検索(google)https://googlebloggertrouble.blogspot.com/search?q=google
検索(google)2ページ目https://googlebloggertrouble.blogspot.com/search?q=google&updated-max=2019-04-22T00:00:00%2B09:00&max-results=20&start=20&by-date=false&token=CkD_AL_hkPdAAP8A_wD___73guHtcf8k8QHOzM_JycbIzM7Jzs7LyMvIyM7Fzs3Nzc7Gxs_HyczGyMfHxsnNz__-EBQhPFyLSEHlNoVQAFoLCQ-q3MSDEDBIEANgr4CA5gNyBgi0oYGRBg%3D%3D
検索(zzz)結果0件https://googlebloggertrouble.blogspot.com/search?q=zzz
エラーページ(存在しないページ)https://googlebloggertrouble.blogspot.com/zzz
エラーページ(存在しないラベルページ(SEO対策2))https://googlebloggertrouble.blogspot.com/search/label/SEO%E5%AF%BE%E7%AD%962

data:blogpageTypepageName
トップページindex
トップページ2ページ目index
投稿itemGoogle Bloggerブロガーの簡単な始め方
ページstatic_pageサイトマップ
ラベルページ(SEO対策)indexSEO対策searchLabel:'SEO対策'
ラベルページ(SEO対策)2ページ目indexSEO対策searchLabel:'SEO対策'
アーカイブ年archive2021
アーカイブ年月archive5月 2021
検索(google)indexgoogleの検索結果searchQuery:'google'
検索(google)2ページ目indexgoogleの検索結果searchQuery:'google'
検索(zzz)結果0件indexzzzの検索結果searchQuery:'zzz'
エラーページ(存在しないページ)error_page
エラーページ(存在しないラベルページ(SEO対策2))indexSEO対策2searchLabel:'SEO対策2'

data:viewtypeisSingleItemisMultipleItemsisErrorisPageisPostisHomepageisArchiveisSearchisLabelSearch
トップページfeedfalsetruefalsefalsefalsetruefalsefalse
トップページ2ページ目feedfalsetruefalsefalsefalsefalsefalsetruefalsesearch:{}
投稿itemtruefalsefalsefalsetruefalsefalsefalse
ページitemtruefalsefalsetruefalsefalsefalsefalse
ラベルページ(SEO対策)feedfalsetruefalsefalsefalsefalsefalsetruetruesearch:{'label': 'SEO対策'}
ラベルページ(SEO対策)2ページ目feedfalsetruefalsefalsefalsefalsefalsetruetruesearch:{'label': 'SEO対策'}
アーカイブ年feedfalsetruefalsefalsefalsefalsetruefalsearchive:{'year': 2021}
アーカイブ年月feedfalsetruefalsefalsefalsefalsetruefalsearchive:{'year': 2021, 'month': 5}
検索(google)feedfalsetruefalsefalsefalsefalsefalsetruefalsesearch:{'query': 'google'}
検索(google)2ページ目feedfalsetruefalsefalsefalsefalsefalsetruefalsesearch:{'query': 'google'}
検索(zzz)結果0件feedfalsetruefalsefalsefalsefalsefalsetruefalsesearch:{'query': 'zzz'}
エラーページ(存在しないページ)errorfalsefalsetruefalsefalsefalsefalsefalse
エラーページ(存在しないラベルページ(SEO対策2))feedfalsetruefalsefalsefalsefalsefalsetruetruesearch:{'label': 'SEO対策2'}

使い方はこんな感じです。
<b:if cond='data:blog.pageType == "item"'>
(処理)
</b:if>

「投稿」の処理を追加したい場合
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:view.isPost == true'>
<b:if cond='data:view.isPost'>
全部同じ意味なので、一番短い
<b:if cond='data:view.isPost'>
を使います。

「投稿」以外の処理を追加したい場合
<b:if cond='data:blog.pageType != "item"'>
<b:if cond='data:view.isPost != true'>
<b:if cond='data:view.isPost == false'>
<b:if cond='!data:view.isPost'>
全部同じ意味なので、一番短い
<b:if cond='!data:view.isPost'>
を使います。

「トップページ」の処理を追加したい場合
<b:if cond='data:view.isHomepage'>
「投稿」の処理を追加したい場合
<b:if cond='data:view.isPost'>
「ページ」の処理を追加したい場合
<b:if cond='data:view.isPage'>
「ラベルページ」の処理を追加したい場合
<b:if cond='data:view.isLabelSearch'>
「アーカイブ年」「アーカイブ年月」の処理を追加したい場合
<b:if cond='data:view.isArchive'>
「検索」の処理を追加したい場合
<b:if cond='data:blog.searchQuery'>
「エラーページ」の処理を追加したい場合
<b:if cond='data:view.isError'>
「投稿」か「ページ」の場合の処理を追加したい場合
<b:if cond='data:view.isSingleItem'>
「投稿」と「ページ」以外の場合の処理を追加したい場合
<b:if cond='data:view.isMultipleItems'>

他にもdata:blogとdata:viewにはurlが設定されています。
https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html?m=1 の場合
urlcanonicalUrlhomepageUrlcanonicalHomepageUrl
data:bloghttps://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.htmlhttps://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.htmlhttps://googlebloggertrouble.blogspot.com/https://googlebloggertrouble.blogspot.com/
data:viewhttps://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html

「url」と「canonicalUrl」、「homepageUrl」と「canonicalHomepageUrl」の違いは、「canonicalUrl」と「canonicalHomepageUrl」は正規化と言われるGoogleなどに登録される正しいurlです。

https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html?m=1 がGoogleに登録されても正しいurlは https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html と伝えるためにあります。
iphoneで確認しましたが、「url」は https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html?m=1 ではなく、 https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html でした。「url」と「canonicalUrl」、「homepageUrl」と「canonicalHomepageUrl」は結局同じになりました。

複数のサイトで同じテンプレートを使うときに特定のサイトを指定する場合
<b:if cond='data:blog.canonicalHomepageUrl == "https://googlebloggertrouble.blogspot.com/"'>
特定のサイトの特定のページを指定する場合
<b:if cond='data:blog.canonicalUrl == "https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html"'>
複数のサイトで同じテンプレートを使うときに複数のサイトの特定のページを指定する場合
<b:if cond='data:blog.canonicalUrl == data:blog.canonicalHomepageUrl path "2019/04/bloggerstart.html"'>

スマホで見た場合はurlの最後に?m=1が付きます。
data:blogisMobileisMobileRequestmobileClass
投稿 https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.htmlfalsefalse
投稿(スマホで見た場合) https://googlebloggertrouble.blogspot.com/2019/04/bloggerstart.html?m=1falsetrue
この記事のタイトルとURLをコピーする blogger
blogger