記事中に画像がない場合のサムネイルを設定する【Blogger/QooQカスタマイズ】

1

この記事はQooQ list版というテンプレートをもとに作成しています。

初期状態だと記事中に画像がない場合サムネイルが表示されないため上の画像のように表示が異なります。

今回はこれを改善したいと思います。

導入方法

この手順ではテンプレートのHTMLを編集するためテンプレートのバックアップを取ることを推奨します。

トップページのサムネイルの変更方法

まずはトップぺージのサムネイルの表示を変更していきます。

テンプレートのHTMLを編集する画面から

<div class='list-item-img-box'>

を検索して探します。

<b:if cond='data:post.thumbnailUrl'>
  <div class='list-item-img-box'>
    <a expr:href='data:post.url'>
      <img class='list-item-img' expr:src='data:post.thumbnailUrl'/>
    </a>
  </div>
</b:if>

付近に上記のコードがあるのでこれを下記のコードに書き換えます。

<b:if cond='data:post.firstImageUrl'>
  <div class='list-item-img-box'>
    <a expr:href='data:post.url'>
      <img class='list-item-img' expr:src='data:post.firstImageUrl' alt='サムネイル'/>
    </a>
  </div>
<b:else/>
  <div class='list-item-img-box'>
    <a expr:href='data:post.url'>
      <img class='list-item-img' src='画像のURL' alt='サムネイル'/>
    </a>
  </div>
</b:if>

画像のURLとなっているところは記事中に画像がない場合にサムネイルとして表示させたい画像のURLを指定してください。

これでトップページのサムネイルが表示されるはずです。

関連記事のサムネイルの変更方法

次は関連記事のサムネイルの表示を変更していきます。

今度はテンプレートのHTMLを編集する画面から

r.thumbnail="noneImage"

を検索して探します。

このコードの

noneImage

というコードを表示させたい画像のURLに書き換えてください。

これで関連記事のサムネイルが表示されるはずです。

まとめ

今回は記事中に画像がない場合のサムネイルを設定する方法を紹介しました。

間違っているところや質問があれば気軽にコメントもらえると嬉しいです。

1 コメント

  1. 匿名16:39

    Additionally, slot machine payouts can really range per machine, and are typically 카지노 사이트 extra in line with the Sinnoh games versus the unique Generation II games. I agree with everyone who contributed to the article, which states the RNG is not RNG. {I have|I even have|I really have} proven over 12 years of playing in} land-based slots in the USA that slot machines usually are not random, as individuals and others claiming to be specialists declare. I study patterns on quantity of} hundred slot machine plays, playing in} every week.

    返信削除

お問い合わせ

名前

メール *

メッセージ *