洗練されたデザインのブログアイキャッチテンプレート

image0

このテーマの特徴

このHTMLテンプレートは、ブログ記事のアイキャッチ画像として使用できる、シンプルながらも洗練されたデザインのテンプレートです。主な特徴は以下の通りです。

1. カスタマイズ可能なデザイン:

  • カラーテーマ: --bg-main--bg-secondary--text-main--text-back--accent-color といったCSS変数を使って、背景色、テキスト色、アクセントカラーを簡単に変更できます。
  • 角丸: --content-rounded 変数でコンテンツの角丸の度合いを調整できます。
  • フォント: デフォルトでは Noto Sans CJK JP フォントを使用していますが、他のフォントに変更することも可能です。
  • アイコン: アイコンはSVGで記述されており、{BlogLanguage} に応じて変更できます。

2. ブログ記事の主要な情報を表示:

  • ブログタイトル: {BlogTitle} にブログのタイトルを設定します。
  • カテゴリ: {FirstCategory} に記事の第一カテゴリを設定します。複数カテゴリの場合、{SecondCategory}{ThirdCategory} などを追加することも可能です。
  • 記事タイトル: {Title} に記事のタイトルを設定します。
  • 記事の短い説明文: <!-- 記事の短い説明文など --> 部分に、記事の内容を簡単に説明する文章を追加します。

3. レスポンシブデザイン:

  • テンプレートは基本的なレスポンシブデザインに対応しており、様々なデバイスで適切な表示が行われます。

4. SEOに配慮した設計:

  • テンプレートは、meta charset="utf-8" を設定することで、日本語などのマルチバイト文字を正しく表示します。
  • lang="{BlogLanguage}" 属性で言語を指定することで、SEOの向上に役立ちます。

5. 簡潔で読みやすいコード:

  • テンプレートは、CSS変数を使用し、整理されたCSSで記述されているため、理解しやすく、変更が容易です。

6. ブログ記事に適した構造:

  • ヘッダー、メインコンテンツ、フッターといった、ブログ記事に一般的な構造を採用しています。
  • 記事タイトル、記事の短い説明文、CTAボタンといった、アイキャッチ画像に必要な要素を備えています。

7. カテゴリによるカスタマイズ:

  • body.category-{FirstCategory} を使用することで、カテゴリ別にデザインを変更できます。
  • 例えば、日記カテゴリの場合は body.category-日記 { background-color: #fff; } のように、背景色を変更できます。

このテンプレートは、様々なブログに適用可能な汎用性があり、カスタマイズ性も高いため、自身のブログに合わせて自由に調整できます。

ソースコード

<!DOCTYPE html>
<html lang="{BlogLanguage}">
  <head>
    <meta charset="utf-8">
    <style>
      :root {
        --bg-main: #F5F5F5; /* メイン背景色 */
        --bg-secondary: #003368; /* セカンダリー背景色 */
        --text-main: #003368; /* メインテキスト色 */
        --text-back: #d4e3f0; /* カテゴリー背景色 */
        --accent-color: #F2C94C; /* アクセントカラー */
        --content-rounded: 12px; /* コンテンツの角丸 */
      }

      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      body {
        background-color: var(--bg-secondary);
        color: var(--text-main);
        font-weight: normal;
        font-family: 'Noto Sans CJK JP';
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding: 24px 24px;
        line-height: 1.4;
        word-break: break-word;
      }

      /* カテゴリによるカスタマイズ */
      body.category-日記 {
        background-color: #fff;
      }

      /* コンテンツ部分の共通設定 */
      body > div {
        background-color: var(--bg-main);
        padding: 24px;
      }

      body > div:first-child {
        border-radius: var(--content-rounded) var(--content-rounded) 0 0;
      }

      body > div:last-child {
        border-radius: 0 0 var(--content-rounded) var(--content-rounded);
      }

      /* ヘッダーの設定 */
      .header {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 18px;
      }

      .header > :first-child {
        margin-left: 24px;
      }

      .header > :last-child {
        margin-right: 24px;
      }

      .header .base {
        display: flex;
        flex-direction: row;
        align-items: center;
      }

      .icon > svg,
      .icon > img {
        border-radius: 50%;
        width: 64px;
        margin-right: 12px;
      }

      .blog-title {
        max-width: 60%;
      }

      .blog-title .title {
        font-size: 48px;
        font-weight: bold;
        color: var(--text-main);
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

      .spacer {
        flex-grow: 1;
      }

      .category {
        display: flex;
        justify-content: center;
        gap: 15px;
        max-width: 25%;
      }

      .category span {
        display: block;
        box-sizing: border-box;
        padding: 2px 12px;
        border-radius: 8px;
        background-color: var(--text-back);
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-size: 30px;
        line-height: 1.3;
        font-weight: bold;
        color: var(--text-main);
      }

      .category span:empty {
        display: none;
      }

      /* メインコンテンツの設定 */
      .main-wrapper {
        flex: 1;
        width: 100%;
        display: flex;
        padding-bottom: 56px;
      }

      .main {
        width: 75%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin: 20px auto 8px;
        overflow: hidden;
        text-align: center;
      }

      .entry-title {
        display: -webkit-box;
        -webkit-line-clamp: 4;
        line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
        overflow-wrap: break-word;
        word-break: auto-phrase;
        color: var(--text-main);
        font-size: 56px;
        line-height: 1.3;
        font-weight: bold;
        margin-bottom: 16px;
      }

      .entry-subtitle {
        font-size: 18px;
        line-height: 1.5;
        color: var(--text-main);
        margin-bottom: 24px;
      }

      .cta-button {
        background-color: var(--accent-color);
        color: #fff;
        padding: 12px 24px;
        border-radius: 8px;
        text-decoration: none;
        font-size: 18px;
        font-weight: bold;
        transition: background-color 0.3s ease;
      }

      .cta-button:hover {
        background-color: darken(var(--accent-color), 10%); /* 色を少し暗くする */
      }
    </style>
  </head>
  <body class="category-{FirstCategory}">
    <div class="header">
      <div class="icon">
        <svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" viewBox="0 0 90 90">
          <path d="M45,90A45,45,0,1,1,90,45,45.05,45.05,0,0,1,45,90ZM45,5.723A39.278,39.278,0,1,0,84.281,45,39.322,39.322,0,0,0,45,5.723Z" fill="#333"></path>
          <path d="M50.241,22.78a63.54,63.54,0,0,1-4.22-11.3V43.349a2.938,2.938,0,1,1-1.879-.051V11.442A63.6,63.6,0,0,1,39.914,22.78a115.111,115.111,0,0,1-7.739,13.113l2.746,37.579s2.61,2.913,10.151,2.916h.01c7.54,0,10.151-2.916,10.151-2.916l2.746-37.579A115.02,115.02,0,0,1,50.241,22.78Z" fill="#333"></path>
        </svg>
      </div>
      <div class="blog-title">
        <div class="title">{BlogTitle}</div>
      </div>
      <div class="spacer"></div>
      <div class="category">
        <span>{FirstCategory}</span>
      </div>
    </div>
    <div class="main-wrapper">
      <div class="main">
        <div class="entry-title">{Title}</div>
        <div class="entry-subtitle">
          <!-- 記事の短い説明文など -->
        </div>
        <a href="#" class="cta-button">続きを読む</a>
      </div>
    </div>
  </body>
</html>