Powered by SmartDoc

5.2.1 ページのカスタマイズ

  1. ベースとするテーマを展開

    kiri@smtp:~/projects/jekyll[1017]% git clone https://github.com/raviriley/agency-jekyll-theme.git
    Cloning into 'agency-jekyll-theme'...
    remote: Enumerating objects: 1213, done.
    remote: Counting objects: 100% (25/25), done.
    remote: Compressing objects: 100% (22/22), done.
    remote: Total 1213 (delta 5), reused 22 (delta 3), pack-reused 1188
    Receiving objects: 100% (1213/1213), 7.43 MiB | 11.65 MiB/s, done.
    Resolving deltas: 100% (620/620), done.
    kiri@smtp:~/projects/jekyll[1018]% 

  2. とりあえずGemファイルを作成
    1. スペック名をjekyll-theme-agencyに変更

      kiri@smtp:~/projects/jekyll/agency-jekyll-theme.org[1075]% diff -u jekyll-agency.gemspec~ jekyll-agency.gemspec
      --- jekyll-agency.gemspec~      2022-07-29 10:08:24.422123000 +0900
      +++ jekyll-agency.gemspec       2022-08-01 15:37:05.588142000 +0900
      @@ -1,5 +1,5 @@
       Gem::Specification.new do |spec|
      -  spec.name     = "jekyll-agency"
      +  spec.name     = "jekyll-theme-agency"
         spec.version  = "1.1.0"
         
         spec.authors  = ["Ravi Riley"]
      kiri@smtp:~/projects/jekyll/agency-jekyll-theme.org[1076]% 

    2. Gemファイルを作成

      kiri@smtp:~/projects/jekyll/agency-jekyll-theme[1060]% gem build jekyll-agency.gemspec
        Successfully built RubyGem
        Name: jekyll-agency
        Version: 1.1.0
        File: jekyll-agency-1.1.0.gem
      kiri@smtp:~/projects/jekyll/agency-jekyll-theme[1061]% ll
      total 3311
      drwxr-xr-x  10 kiri  admin       22  7月 29 10:10 .
      drwxr-xr-x  12 kiri  admin       12  7月 29 10:08 ..
      drwxr-xr-x   8 kiri  admin       13  7月 29 10:08 .git
      -rw-r--r--   1 kiri  admin       66  7月 29 10:08 .gitattributes
      drwxr-xr-x   3 kiri  admin        6  7月 29 10:08 .github
      -rw-r--r--   1 kiri  admin       90  7月 29 10:08 .gitignore
      -rw-r--r--   1 kiri  admin      417  7月 29 10:08 404.html
      -rw-r--r--   1 kiri  admin      247  7月 29 10:08 Gemfile
      -rw-r--r--   1 kiri  admin     1077  7月 29 10:08 LICENSE.txt
      -rw-r--r--   1 kiri  admin     6716  7月 29 10:08 README.md
      -rw-r--r--   1 kiri  admin     1469  7月 29 10:08 _config.yml
      drwxr-xr-x   2 kiri  admin        5  7月 29 10:08 _data
      drwxr-xr-x   2 kiri  admin       14  7月 29 10:08 _includes
      drwxr-xr-x   2 kiri  admin        5  7月 29 10:08 _layouts
      drwxr-xr-x   2 kiri  admin        5  7月 29 10:08 _portfolio
      drwxr-xr-x   5 kiri  admin        5  7月 29 10:08 _sass
      drwxr-xr-x   5 kiri  admin        5  7月 29 10:08 assets
      -rw-r--r--   1 kiri  admin       21  7月 29 10:08 index.md
      -rw-r--r--   1 kiri  admin  2074624  7月 29 10:10 jekyll-themr-agency-1.1.0.gem
      -rw-r--r--   1 kiri  admin      841  7月 29 10:08 jekyll-agency.gemspec
      -rw-r--r--   1 kiri  admin     1485  7月 29 10:08 legal.md
      -rw-r--r--   1 kiri  admin  1161443  7月 29 10:08 screenshot.PNG
      kiri@smtp:~/projects/jekyll/agency-jekyll-theme[1062]% 

  3. ロケールの設定
    1. メニューの設定

       _data/navigation.yml に ja を追加

      diff --git a/_data/navigation.yml b/_data/navigation.yml
      index e0d1561..ff9aa52 100644
      --- a/_data/navigation.yml
      +++ b/_data/navigation.yml
      @@ -75,3 +75,22 @@ de: &DEFAULT_DE
             section: Kontakt
           - title: "Quellcode des Themas"
             url: https://github.com/raviriley/agency-jekyll-theme/
      +
      +# Japanese
      +# -----------------
      +ja: &DEFAULT_JA
      +  nav:
      +    - title: "主な活動"
      +      section: services
      +    - title: "これまでの実績"
      +      section: portfolio
      +    - title: "私達について"
      +      section: about
      +    - title: "これまでの歩み"
      +      section: timeline
      +    - title: "すばらしい仲間"
      +      section: team
      +    - title: "私達への連絡"
      +      section: contact
      +    - title: "テーマのソース"
      +      url: https://github.com/raviriley/agency-jekyll-theme/
      

    2. サイト内コンテンツの日本語化

       _data/sitetext.yml に ja を追加

      diff --git a/_data/sitetext.yml b/_data/sitetext.yml
      index 9c45768..43d4291 100644
      --- a/_data/sitetext.yml
      +++ b/_data/sitetext.yml
      @@ -471,3 +471,154 @@ de: &DEFAULT_DE
               icon: "fab fa-github"
             - url: https://instagram.com
               icon: "fab fa-instagram"
      +
      +# Japanese
      +# -----------------
      +ja: &DEFAULT_JA
      +  header:
      +    title: 私達のコミュニティへ ようこそ!
      +    text: 開かれた本当の草の根
      +    button: 詳しくはこちらへ
      +    buttonlink: "#services"
      +
      +  services:
      +    title: "主な活動"
      +    text: "OpenAGR の主な活動"
      +    section: services
      +    list:
      +      - title: "□□□□□□□□"
      +        desc: "□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□"
      +        icon: fas fa-shopping-cart #find more at https://fontawesome.com/icons
      +      - title: "□□□□□□□□"
      +        desc: "□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□"
      +        icon: fas fa-laptop
      +      - title: "[Markdown](https://en.wikipedia.org/wiki/Markdown)"
      +        desc: "Your description here, full **Markdown** support"
      +        icon: fab fa-markdown
      +
      +  portfolio:
      +    title: "これまでの実績"
      +    text: "OpenAGR がこれまで行なってきたこと"
      +    section: portfolio
      +    closebutton: "プロジェクトを閉じる"
      +
      +  timeline:
      +    title: "これまでの歩み"
      +    text: "OpenAGR が生まれてから現在まで"
      +    section: timeline
      +    # left is the default
      +    #start_align: "left"
      +    events:
      +      - title: "□□□□□□□□"
      +        year: "□□□□-□□□□"
      +        desc: "□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□"
      +        image: assets/img/timeline/1.jpg
      +        alt:
      +      - title: "□□□□□□□□"
      +        year: "□□□□"
      +        desc: "□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□"
      +        image: assets/img/timeline/2.jpg
      +        alt:
      +      - title: "□□□□□□□□"
      +        year: "□□□□"
      +        desc: "□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□"
      +        image: assets/img/timeline/3.jpg
      +        alt: image alt text
      +      - title: "□□□□□□□□"
      +        year: "□□□□-□□□□"
      +        desc: "□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□"
      +        image: assets/img/timeline/4.jpg
      +        alt:
      +        # you can enforce the alignment
      +        align: right
      +    end: "次は <br> あなたの <br> 番です!"
      +
      +  about:
      +    title: "私達について"
      +    text: "私達のことについてお答えします"
      +    body: "OpenAGR (Open Authentic Grassroots) は文字通り「開かれた本当の草の根」です。私達は政党に関係なく、本気で世の中を変える強い気持を持った政治家を議会に送り出すことを目指しています。目標は「全ての人を豊かにし、全ての人が幸せになる」ことです。私達の合言葉は「全ては常に自由でオープンな議論から始まる」です。"
      +    section: about
      +
      +  clients:
      +    section: clients
      +    max-height: 100px
      +    horizontal-scrolling: "" #"yes/no"
      +    list:
      +      - title: "envato"
      +        url: https://github.com/raviriley/agency-jekyll-theme
      +        logo: assets/img/clients/envato.jpg
      +      - title: "designmodo"
      +        url: https://github.com/raviriley/agency-jekyll-theme
      +        logo: assets/img/clients/designmodo.jpg
      +      - title: "themeforest"
      +        url: https://github.com/raviriley/agency-jekyll-theme
      +        logo: assets/img/clients/themeforest.jpg
      +      - title: "Creative Market"
      +        url: https://github.com/raviriley/agency-jekyll-theme
      +        logo: assets/img/clients/creative-market.jpg
      +
      +  team:
      +    title: "すばらしい仲間"
      +    text: "OpenAGR のすばらしい仲間達です"
      +    subtext: □□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
      +    section: team
      +    people:
      +      - name: "□□□□□□□□"
      +        role: "□□□□□□□□"
      +        image: assets/img/team/500x500.jpg
      +        social:
      +          - url: https://twitter.com
      +            icon: fab fa-twitter
      +          - url: https://facebook.com
      +            icon: fab fa-facebook-f
      +          - url: https://linkedin.com
      +            icon: fab fa-linkedin-in
      +      - name: "□□□□□□□□"
      +        role: "□□□□□□□□"
      +        image: assets/img/team/500x500.jpg
      +        social:
      +          - url: https://twitter.com
      +            icon: fab fa-twitter
      +          - url: https://facebook.com
      +            icon: fab fa-facebook-f
      +          - url: https://linkedin.com
      +            icon: fab fa-linkedin-in
      +      - name: "□□□□□□□□"
      +        role: "□□□□□□□□"
      +        image: assets/img/team/500x500.jpg
      +        social:
      +          - url: https://twitter.com
      +            icon: fab fa-twitter
      +          - url: https://facebook.com
      +            icon: fab fa-facebook-f
      +          - url: https://linkedin.com
      +            icon: fab fa-linkedin-in
      +
      +  contact:
      +    title: "私達への連絡"
      +    text: "OpenAGR への緊急のお問い合わせは 123456789 まで"
      +    section: contact
      +    name: "お名前(必須)"
      +    name-validation: "お名前が記入されていません"
      +    email: "メールアドレス(必須)"
      +    email-validation: "メールアドレスが記入されていません"
      +    phone: "お電話番号"
      +    phone-validation: "お電話番号が記入されていません"
      +    message: "ご連絡内容(必須)"
      +    message-validation: "メッセージが記入されていません"
      +    subject: "お問い合わせフォームの送信"
      +    submit: "メッセージを送る"
      +
      +  footer:
      +    legal: "プライバシーポリシー"
      +    social:
      +      - url: https://twitter.com
      +        icon: "fab fa-twitter"
      +      - url: https://facebook.com
      +        icon: "fab fa-facebook-f"
      +      - url: https://linkedin.com
      +        icon: "fab fa-linkedin-in"
      +      - url: https://github.com/raviriley/agency-jekyll-theme
      +        icon: "fab fa-github"
      +      - url: https://instagram.com
      +        icon: "fab fa-instagram"
      

    3. ロケールをjaに切り替え

       _config.yml の locale キーを ja にする

      diff --git a/_config.yml b/_config.yml
      index 3cfc332..85a54e2 100644
      --- a/_config.yml
      +++ b/_config.yml
      @@ -16,7 +16,7 @@ theme: jekyll-agency
       url    : "" # the base hostname & protocol for your site, e.g. http://example.com
       baseurl: "" # the subpath of your site, e.g. /blog
       
      -title      : Your Awesome Website
      +title      : OpenAGR
       email      : your-email@example.com #this is also the email contact forms will go to
       description: "Site description"
       author     : Your Name
      @@ -24,7 +24,7 @@ author     : Your Name
         # path: assets\img\clients\creative-market.jpg
         # height: 60 #height in px, defaults to 52px
       
      -locale: "en-US" # See available languages in _data/sitetext.yml
      +locale: "ja" # See available languages in _data/sitetext.yml
       
       analytics:
         google: #Google Analytics tracking code here
      

    4. 最後にメインページの背景画像を変更

       _data/style.yml の header-image キーで切替えられます

      diff --git a/_data/style.yml b/_data/style.yml
      index 376339d..37c1b8a 100644
      --- a/_data/style.yml
      +++ b/_data/style.yml
      @@ -4,7 +4,7 @@
       #black: "#000"
       
       #Image Customization
      -header-image: "../img/header.png"
      +header-image: "../img/openagr.png"
       contact-image: "../img/contact.png"
       #Font Awesome icon for portfolio grid when an item is hovered over
       #portfolio-icon: fas fa-expand-arrows-alt fa-3x #default: fas fa-plus fa-3x
      

  4. ページのテスト
    1. テストサイトにコピー

      kiri@smtp:~/projects/jekyll[1067]% scp -r agency-jekyll-theme guest@t:~/

    2. テストサイトを立ち上げる

      guest@t:~/agency-jekyll-theme % bundle exec jekyll serve -Ht.truefc.org -P8080
      Configuration file: /home/guest/agency-jekyll-theme/_config.yml
       Theme Config file: /home/guest/agency-jekyll-theme/_config.yml
                  Source: /home/guest/agency-jekyll-theme
             Destination: /home/guest/agency-jekyll-theme/_site
       Incremental build: disabled. Enable with --incremental
            Generating... 
                          done in 0.188 seconds.
        Please add the following to your Gemfile to avoid polling for changes:
          require 'rbconfig'
          if RbConfig::CONFIG['target_os'] =~ /(?i-mx:bsd|dragonfly)/
            gem 'rb-kqueue', '>= 0.2'
          end
       Auto-regeneration: enabled for '/home/guest/agency-jekyll-theme'
          Server address: http://t.truefc.org:8080/
        Server running... press ctrl-c to stop.
      [2022-08-01 09:43:20] ERROR `/favicon.ico' not found.
      %