Merge branch 'master' into production

This commit is contained in:
Cotes Chung 2022-09-23 21:11:32 +08:00
commit 7cc36c5287
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
40 changed files with 639 additions and 386 deletions

View file

@ -22,7 +22,7 @@ Please select the desired item checkbox and change it to "[x]", then delete opti
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
-->
- [ ] I have run `bash ./tools/deploy.sh --dry-run` (at the root of the project) locally and passed
- [ ] I have run `bash ./tools/test.sh` (at the root of the project) locally and passed
- [ ] I have tested this feature in the browser
### Test Configuration

View file

@ -20,18 +20,22 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [2.5, 2.6, 2.7, 3]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Test Site
run: bash tools/deploy.sh --dry-run
run: bash tools/test.sh

View file

@ -1,29 +1,72 @@
name: 'Automatic build'
name: "Build and deploy"
on:
push:
branches:
- main
- master
paths-ignore:
- .gitignore
- README.md
- LICENSE
jobs:
continuous-delivery:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # for posts's lastmod
fetch-depth: 0
# submodules: true
# If using the 'assets' git submodule from Chirpy Starter, uncomment above
# (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets)
- name: Setup Pages
id: pages
uses: actions/configure-pages@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3 # reads from a '.ruby-version' or '.tools-version' file if 'ruby-version' is omitted
bundler-cache: true
- name: Deploy
run: bash tools/deploy.sh
- name: Build site
run: bundle exec jekyll b -d "_site${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: "production"
- name: Test site
run: |
bundle exec htmlproofer _site --disable-external --check-html --allow_hash_href
- name: Upload site artifact
uses: actions/upload-pages-artifact@v1
with:
path: "_site${{ steps.pages.outputs.base_path }}"
deploy:
name: "Deploy site"
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

View file

@ -2,6 +2,26 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [5.3.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.2.1...v5.3.0) (2022-09-23)
### Features
* add multiple authors to a post ([#677](https://github.com/cotes2020/jekyll-theme-chirpy/issues/677)) ([f1d9e99](https://github.com/cotes2020/jekyll-theme-chirpy/commit/f1d9e99bc02d3cd0a6b0cd1beac545f0cc7a24f8)), closes [#675](https://github.com/cotes2020/jekyll-theme-chirpy/issues/675)
* **i18n:** add Bulgarian support ([#612](https://github.com/cotes2020/jekyll-theme-chirpy/issues/612)) ([2fed338](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2fed338ce6d078bf528c9717201fbc475f88cd22))
* **i18n:** add German locale file ([#663](https://github.com/cotes2020/jekyll-theme-chirpy/issues/663)) ([940b281](https://github.com/cotes2020/jekyll-theme-chirpy/commit/940b2810e95065e30600ae8d5e4612e7183da60e))
* **i18n:** add Hungarian locale file ([#597](https://github.com/cotes2020/jekyll-theme-chirpy/issues/597), [#598](https://github.com/cotes2020/jekyll-theme-chirpy/issues/598)) ([b032977](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b0329775fc24d0323e5cc04cda46ece8b4531802))
* **i18n:** add Turkish language ([#631](https://github.com/cotes2020/jekyll-theme-chirpy/issues/631)) ([ad137fa](https://github.com/cotes2020/jekyll-theme-chirpy/commit/ad137fa2945b1870b9c1dd5e9212a5f4af7c3580))
### Bug Fixes
* add missing color to linkedin icon for share list ([#683](https://github.com/cotes2020/jekyll-theme-chirpy/issues/683)) ([0dcd39d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0dcd39d491c9c49e4acf7f75f83fe6e1d1839e37))
* code contains spaces in headings ([#644](https://github.com/cotes2020/jekyll-theme-chirpy/issues/644)) ([3fa1bf3](https://github.com/cotes2020/jekyll-theme-chirpy/commit/3fa1bf305451f645a7f3aa93863b076463c8f165))
* correct spelling of `panel` ([#686](https://github.com/cotes2020/jekyll-theme-chirpy/issues/686)) ([b288587](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b288587c1c3d113a1c52c2d25fb46cddda348961))
* correct the i18n for tab titles ([0c5b697](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0c5b697fd3b283b6a5c926742b61ed49d8688c18))
* the `code` doesnt wrap inside the prompt ([#626](https://github.com/cotes2020/jekyll-theme-chirpy/issues/626)) ([378b65a](https://github.com/cotes2020/jekyll-theme-chirpy/commit/378b65a0617787813519dde74d6f741f255eff3d))
## [5.2.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.2.0...v5.2.1) (2022-06-17)

View file

@ -73,7 +73,7 @@ After a while, navigate to the site at <http://localhost:4000>.
## Documentation
For more details on usage, please refer to the tutorial on the [demo website](https://cotes2020.github.io/chirpy-demo/) / [wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Note that the tutorial is based on the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags), and the features of the default branch are usually ahead of the documentation.
For more details on usage, please refer to the tutorial on the [demo website](https://cotes2020.github.io/chirpy-demo/) / [wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Note that the tutorial is based on the [latest release](https://github.com/cotes2020/jekyll-theme-chirpy/releases/latest), and the features of the default branch are usually ahead of the documentation.
## Contributing

83
_data/locales/bg-BG.yml Normal file
View file

@ -0,0 +1,83 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Публикация
category: Категория
tag: Тагове
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Начало
categories: Категории
tags: Тагове
archives: Архив
about: За мен
# the text displayed in the search bar & search results
search:
hint: търси
cancel: Отмени
no_results: Упс! Не са намерени резултати.
panel:
lastmod: Наскоро обновени
trending_tags: Популярни тагове
toc: Съдържание
copyright:
# Shown at the bottom of the post
license:
template: Тази публикация е лицензирана под :LICENSE_NAME от автора.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Някои права запазени.
verbose: >-
Освен ако не е посочено друго, публикациите в блога на този сайт са лицензирани
под лиценза Creative Commons Attribution 4.0 (CC BY 4.0) от автора.
meta: Създадено чрез :PLATFORM и :THEME тема.
not_found:
statment: Съжалявам, но този на този URL адрес няма налично съдържание.
notification:
update_found: Налична е нова версия на съдържанието.
update: Обнови
# ----- Posts related labels -----
post:
written_by: Автор
posted: Публикувана
updated: Обновена
words: думи
pageview_measure: преглеждания
read_time:
unit: мин
prompt: четиво
relate_posts: Още за четене
share: Споделете
button:
next: По-нови
previous: По-стари
copy_code:
succeed: Копирано!
share_link:
title: Копирай линк
succeed: Линкът е копиран успешно!
# pinned prompt of posts list on homepage
pin_prompt: Прикрепен
# categories page
categories:
category_measure:
singular: категория
plural: категории
post_measure:
singular: публикация
plural: публикации

82
_data/locales/de-DE.yml Normal file
View file

@ -0,0 +1,82 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Eintrag
category: Kategorie
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Startseite
categories: Kategorien
tags: Tags
archives: Archiv
about: Über
# the text displayed in the search bar & search results
search:
hint: Suche
cancel: Abbrechen
no_results: Ups! Keine Einträge gefunden.
panel:
lastmod: Kürzlich aktualisiert
trending_tags: Beliebte Tags
toc: Inhalt
copyright:
# Shown at the bottom of the post
license:
template: Dieser Eintrag ist vom Autor unter :LICENSE_NAME lizensiert.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Einige Rechte vorbehalten.
verbose: >-
Alle Einträge auf dieser Seite stehen, soweit nicht anders angegeben, unter der Lizenz Creative Commons Attribution 4.0 (CC BY 4.0).
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource.
notification:
update_found: Eine neue Version ist verfügbar.
update: Neue Version
# ----- Posts related labels -----
post:
written_by: Von
posted: Veröffentlicht
updated: Aktualisiert
words: Wörter
pageview_measure: Aufrufe
read_time:
unit: Minuten
prompt: lesen
relate_posts: Weiterlesen
share: Teilen
button:
next: Nächster Eintrag
previous: Eintrag vorher
copy_code:
succeed: Kopiert!
share_link:
title: Link kopieren
succeed: Link erfolgreich kopiert!
# pinned prompt of posts list on homepage
pin_prompt: Angepinnt
# categories page
categories:
category_measure:
singular: Kategorie
plural: Kategorien
post_measure:
singular: Eintrag
plural: Einträge

81
_data/locales/hu-HU.yml Normal file
View file

@ -0,0 +1,81 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Bejegyzés
category: Kategória
tag: Címke
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Kezdőlap
categories: Kategóriák
tags: Címkék
archives: Archívum
about: Rólam
# the text displayed in the search bar & search results
search:
hint: keresés
cancel: Mégse
no_results: Oops! Nincs találat a keresésre.
panel:
lastmod: Legutóbb frissítve
trending_tags: Népszerű Címkék
toc: Tartalom
links: Blog linkek
copyright:
# Shown at the bottom of the post
license:
template: A bejegyzés :LICENSE_NAME licenccel rendelkezik.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Néhány jog fenntartva.
verbose: >-
Az oldalon található tartalmak
Creative Commons Attribution 4.0 International (CC BY 4.0) licenccel rendelkeznek,
hacsak másképp nincs jelezve.
meta: Készítve :PLATFORM motorral :THEME témával.
not_found:
statment: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat.
notification:
update_found: Elérhető a tartalom új verziója.
update: Frissítés
# ----- Posts related labels -----
post:
written_by: Szerző
posted: Létrehozva
updated: Frissítve
words: szó
pageview_measure: látogató
read_time:
unit: perc
prompt: elolvasni
relate_posts: További olvasnivaló
share: Megosztás
button:
next: Újabb
previous: Régebbi
copy_code:
succeed: Másolva!
share_link:
title: Link másolása
succeed: Link sikeresen másolva!
# pinned prompt of posts list on homepage
pin_prompt: Kitűzve
# categories page
categories:
category_measure: kategória
post_measure: bejegyzés

79
_data/locales/tr-TR.yml Normal file
View file

@ -0,0 +1,79 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Gönderi
category: Kategori
tag: Etiket
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Ana Sayfa
categories: Kategoriler
tags: Etiketler
archives: Arşiv
about: Hakkında
# the text displayed in the search bar & search results
search:
hint: Ara...
cancel: İptal
no_results: Hop! Öyle bir şey bulamadım.
panel:
lastmod: Yeni Güncellendi
trending_tags: Yükselen Etiketler
toc: İçindekiler
copyright:
# Shown at the bottom of the post
license:
template: Bu gönderi :LICENSE_NAME lisansı altındadır.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/deed.tr
# Displayed in the footer
brief: Bazı hakları saklıdır.
verbose: >-
Aksi belirtilmediği sürece, bu sitedeki gönderiler Creative Commons Atıf 4.0 Uluslararası (CC BY 4.0) Lisansı altındadır.
Kısaca sayfa linkini de vererek paylaşabilir veya düzenleyip paylaşabilirsin.
meta: :PLATFORM ve :THEME teması.
not_found:
statment: Üzgünüz, bu linki yanlış yerleştirdik veya var olmayan bir şeye işaret ediyor.
notification:
update_found: İçeriğin yeni bir sürümü mevcut.
update: Güncelle
# ----- Posts related labels -----
post:
written_by: Yazan
posted: Gönderilme Tarihi
updated: Güncellenme Tarihi
words: sözcük
pageview_measure: görüntülenme
read_time:
unit: dakikada
prompt: okunabilir
relate_posts: Benzer Gönderiler
share: Paylaş
button:
next: İleri
previous: Geri
copy_code:
succeed: Kopyalandı.
share_link:
title: Linki kopyala
succeed: Link kopyalandı.
# pinned prompt of posts list on homepage
pin_prompt: Sabitlendi
# categories page
categories:
category_measure: kategori
post_measure: gönderi

View file

@ -2,7 +2,7 @@
The paginator for post list on HomgPage.
-->
<ul class="pagination align-items-center mt-4 mb-5 pl-lg-2">
<ul class="pagination align-items-center mt-4 pl-lg-2">
<!-- left arrow -->
{% if paginator.previous_page %}
{% assign prev_url = paginator.previous_page_path | relative_url %}

View file

@ -214,7 +214,7 @@
{% assign left = snippet | split: mark_end | first %}
{% assign right = snippet | slice: left.size, snippet.size %}
{% assign left = left | replace: '">', '"><span class="mr-2">' | append: '</span>' %}
{% assign left = left | replace_first: '">', '"><span class="mr-2">' | append: '</span>' %}
{% assign _new_content = _new_content | append: mark_start
| append: left | append: anchor | append: right

View file

@ -76,8 +76,8 @@
{% endif %}
{% if index_list.size > 0 %}
<div id="related-posts" class="mt-5 mb-2 mb-sm-4">
<h3 class="pt-2 mt-1 mb-4 ml-1"
<div id="related-posts" class="mb-2 mb-sm-4">
<h3 class="pt-2 mb-4 ml-1"
data-toc-skip>{{ site.data.locales[lang].post.relate_posts }}</h3>
<div class="card-deck mb-4">
{% for entry in index_list %}

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -13,36 +13,29 @@ layout: page
{% assign df_dayjs_m = '/ MM' %}
{% endif %}
<div id="archives" class="pl-xl-2">
<div id="archives" class="pl-xl-3">
{% for post in site.posts %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
{% if forloop.first %}
{% assign last_day = "" %}
{% assign last_month = "" %}
<span class="lead">{{this_year}}</span>
<ul class="list-unstyled">
{% endif %}
<li>
<div>
{% assign ts = post.date | date: '%s' %}
<span class="date day" data-ts="{{ ts }}" data-df="DD">
{{ post.date | date: "%d" }}
</span>
<span class="date month small text-muted" data-ts="{{ ts }}" data-df="{{ df_dayjs_m }}">
{{ post.date | date: df_strftime_m }}
</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div>
</li>
{% if forloop.last %}
</ul>
{% elsif this_year != pre_year %}
</ul>
<span class="lead">{{pre_year}}</span>
<ul class="list-unstyled">
{% assign last_day = "" %}
{% assign last_month = "" %}
{% capture cur_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% if cur_year != last_year %}
{% unless forloop.first %}</ul>{% endunless %}
<div class="year lead">{{ cur_year }}</div>
<ul class="list-unstyled">
{% assign last_year = cur_year %}
{% endif %}
<li>
{% assign ts = post.date | date: '%s' %}
<span class="date day" data-ts="{{ ts }}" data-df="DD">{{ post.date | date: "%d" }}</span>
<span class="date month small text-muted ml-1" data-ts="{{ ts }}" data-df="{{ df_dayjs_m }}">
{{ post.date | date: df_strftime_m }}
</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</li>
{% if forloop.last %}</ul>{% endif %}
{% endfor %}
</div>

View file

@ -9,7 +9,7 @@ layout: default
<div class="row">
<!-- core -->
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-4">
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-4 pb-5">
<div class="post pl-1 pr-1 pl-md-2 pr-md-2">
{% capture _content %}
@ -20,7 +20,8 @@ layout: default
{% endif %}
{% endcapture %}
{% if page.layout == 'page' or page.collection == 'tabs'%}
{% if page.collection == 'tabs' %}
{% assign tab_key = page.title | downcase %}
{% assign title = site.data.locales[lang].tabs[tab_key] | default: page.title %}
<h1 class="dynamic-title">
{{ title }}
@ -35,7 +36,7 @@ layout: default
</div>
</div> <!-- #core-wrapper -->
<!-- pannel -->
<!-- panel -->
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted">
<div class="access">
@ -43,7 +44,7 @@ layout: default
{% include trending-tags.html %}
</div>
{% for _include in layout.pannel_includes %}
{% for _include in layout.panel_includes %}
{% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} %}
{% endfor %}

View file

@ -1,7 +1,7 @@
---
layout: page
refactor: true
pannel_includes:
panel_includes:
- toc
tail_includes:
- related-posts
@ -50,32 +50,32 @@ tail_includes:
{% endif %}>
{% if page.image.alt %}
<figcaption class="pt-2 pb-2">{{ page.image.alt }}</figcaption>
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
{% endif %}
</div>
{% endif %}
<div class="d-flex justify-content-between">
<!-- author -->
<!-- author(s) -->
<span>
{% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %}
{% assign author_link = nil %}
{% if page.author %}
{% assign author_link = site.data.authors[page.author].url %}
{% elsif author_name == site.social.name %}
{% assign author_link = site.social.links[0] %}
{% assign authors = page.author %}
{% elsif page.authors %}
{% assign authors = page.authors %}
{% endif %}
{{ site.data.locales[lang].post.written_by }}
<em>
{% if author_link %}
<a href="{{ author_link }}">{{ author_name }}</a>
{% else %}
{{ author_name }}
{% endif %}
{% if authors %}
{% for author in authors %}
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
{% unless forloop.last %}</em>, <em>{% endunless %}
{% endfor %}
{% else %}
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>
{% endif %}
</em>
</span>

View file

@ -48,7 +48,7 @@ tags: [bee]
The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows:
Add author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one.)
Adding author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one).
```yaml
<author_id>:
@ -58,15 +58,21 @@ Add author information in `_data/authors.yml` (If your website doesn't have this
```
{: file="_data/authors.yml" }
And then set up the custom author in the post's YAML block:
And then use `author` to specify a single entry or `authors` to specify multiple entries:
```yaml
---
author: <author_id>
author: <author_id> # for single entry
# or
authors: [<author1_id>, <author2_id>] # for multiple entries
---
```
> Another benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO.
Having said that, the key `author` can also identify multiple entries.
> The benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO.
{: .prompt-info }
## Table of Contents
@ -248,6 +254,8 @@ Except for `alt`, all other options are necessary, especially the `width` and `h
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height``h`, `width``w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
Starting from _Chirpy v5.2.0_, the property for the preview image is changed to `image.path`. If upgrading the theme from a prior version, you will have to update posts' metadata to use new image property.
## Pinned Posts
You can pin one or more posts to the top of the home page, and the fixed posts are sorted in reverse order according to their release date. Enable by:

View file

@ -68,7 +68,7 @@ Update the variables of `_config.yml`{: .filepath} as needed. Some of them are t
- `timezone`
- `lang`
### Customing Stylesheet
### Customizing Stylesheet
If you need to customize the stylesheet, copy the theme's `assets/css/style.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of the style file.
@ -105,31 +105,15 @@ Before the deployment begins, check out the file `_config.yml`{: .filepath} and
Now you can choose ONE of the following methods to deploy your Jekyll site.
### Deploy by Using Github Actions
### Deploy by Using GitHub Actions
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GitHub Pages service.
Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`{: .filepath}. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. And then rename your repository to `<GH_USERNAME>.github.io` on GitHub.
Quickly check the files needed for GitHub Actions build:
Now publish your Jekyll site:
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`{: .filepath}. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
1. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar. Then, in the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu.
- Ensure your Jekyll site has file `tools/deploy.sh`{: .filepath}. Otherwise, copy it from here to your Jekyll site.
- Furthermore, if you have committed `Gemfile.lock`{: .filepath} to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lock file:
```console
$ bundle lock --add-platform x86_64-linux
```
After the above steps, rename your repository to `<GH_USERNAME>.github.io` on GitHub.
Now publish your Jekyll site by:
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
2. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar, and then in the section **Source** of _GitHub Pages_, select the `/(root)` directory of branch `gh-pages` as the [publishing source][pages-src]. Remember to click <kbd>Save</kbd> before leaving.
![gh-pages-sources](/posts/20190809/gh-pages-sources.png){: width="1580" height="250" }
2. Push any commit to remote to trigger the GitHub Actions workflow. In the _Actions_ tab of your repository, you should see the "Deploy Jekyll with GitHub Pages" workflow with at least one job running. Once the build is complete and successful, the site should be deployed automatically.
3. Visit your website at the address indicated by GitHub.
@ -182,5 +166,5 @@ The merge is likely to conflict with your local modifications. Please be patient
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
[chirpy-4.1.0]: https://github.com/cotes2020/jekyll-theme-chirpy/releases/tag/v4.1.0
[pages-src]: https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site
[pages-workflow-src]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow
[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags

View file

@ -6,6 +6,8 @@ categories: [Blogging, Tutorial]
tags: [google analytics, pageviews]
---
> The content of this post applies only to [_Universal Analytics property_](https://support.google.com/analytics/answer/10220206) (UA), not [_Google Analytics 4_](https://support.google.com/analytics/answer/10089681) (GA 4). In addition, since [UA is about to be deprecated on Jul 1, 2023](https://support.google.com/analytics/answer/11583528), the Page Views feature of [_Chirpy_][chirpy-homepage] will also be deprecated at that time.
{: .prompt-danger }
This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme based blog that you just built. This requires technical knowledge and it's recommended to keep the `google_analytics.pv.*` empty unless you have a good reason. If your website has low traffic, the page views count would discourage you to write more blogs. With that said, let's start with the setup.

View file

@ -110,6 +110,7 @@ code {
&.highlighter-rouge {
font-size: $code-font-size;
padding: 3px 5px;
word-break: break-word;
border-radius: 4px;
background-color: var(--inline-code-bg);
}

View file

@ -1,7 +1,7 @@
/*!
* The styles for Jekyll theme Chirpy
*
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -2,35 +2,51 @@
Style for Archives
*/
%date-timeline {
content: "";
width: 4px;
left: 75px;
display: inline-block;
float: left;
position: relative;
background-color: var(--timeline-color);
}
#archives {
letter-spacing: 0.03rem;
span.lead {
$timeline-width: 4px;
%timeline {
content: "";
width: $timeline-width;
position: relative;
float: left;
background-color: var(--timeline-color);
}
.year {
height: 3.5rem;
font-size: 1.5rem;
position: relative;
left: 8px;
left: 2px;
margin-left: -$timeline-width;
&::before {
@extend %timeline;
height: 72px;
left: 79px;
bottom: 16px;
}
&:first-child::before {
@extend %timeline;
height: 32px;
top: 24px;
}
&::after { /* Year dot */
content: "";
display: block;
display: inline-block;
position: relative;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
width: 12px;
height: 12px;
top: -26px;
left: 63px;
left: 21.5px;
border: 3px solid;
background-color: var(--timeline-year-dot-color);
border-color: var(--timeline-node-bg);
@ -38,101 +54,82 @@
z-index: 1;
}
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
} // #archives span.lead
}
ul {
li {
font-size: 1.1rem;
line-height: 3rem;
div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
}
}
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
&::after {
@extend %date-timeline;
&::before {
@extend %timeline;
height: 2.8rem;
top: -1.3rem;
}
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
top: 0;
left: 77px;
height: 3.1rem;
}
}
&:not(:last-child) > li:last-child::after {
height: 3.4rem;
&:last-child li:last-child::before {
height: 1.5rem;
}
&:last-child > li:last-child::after {
display: none;
}
} // #archives ul
} /* #archives ul */
.date {
white-space: nowrap;
display: inline-block;
position: relative;
right: 0.5rem;
&.month {
width: 1.4rem;
text-align: center;
~ a::before {
/* A dot for Month and Day */
content: "";
display: inline-block;
position: relative;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
width: 8px;
height: 8px;
float: left;
top: 1.35rem;
left: 69px;
background-color: var(--timeline-node-bg);
box-shadow: 0 0 3px 0 #c2c6cc;
z-index: 1;
}
}
&.day {
font-size: 85%;
font-family: 'Lato', sans-serif;
text-align: center;
margin-right: -2px;
width: 1.2rem;
position: relative;
left: -0.15rem;
}
} // #archives .date
}
a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
&:hover {
border-bottom: none;
}
&::before {
/* the dot before post title */
content: "";
display: inline-block;
position: relative;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
width: 8px;
height: 8px;
float: left;
top: 1.35rem;
left: 71px;
background-color: var(--timeline-node-bg);
box-shadow: 0 0 3px 0 #c2c6cc;
z-index: 1;
}
}
} // #archives

View file

@ -176,7 +176,7 @@
}
/* Pannel hidden */
/* Panel hidden */
@media all and (max-width: 1200px) {
#post-list {
padding-right: 0;

View file

@ -293,6 +293,10 @@ nav[data-toggle=toc] {
@include btn-sharing-color(rgb(39, 159, 217));
}
&.fa-linkedin {
@include btn-sharing-color(rgb(0, 119, 181));
}
&.fa-weibo {
@include btn-sharing-color(rgb(229, 20, 43));
}

View file

@ -1,5 +1,5 @@
---
title: About
# the default layout is 'page'
icon: fas fa-info-circle
order: 4
---

View file

@ -1,6 +1,5 @@
---
layout: archives
title: Archives
icon: fas fa-archive
order: 3
---

View file

@ -1,6 +1,5 @@
---
layout: categories
title: Categories
icon: fas fa-stream
order: 1
---

View file

@ -1,6 +1,5 @@
---
layout: tags
title: Tags
icon: fas fa-tag
order: 2
---

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -1,5 +1,5 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* Chirpy v5.3.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* MIT Licensed
*/

View file

@ -2,7 +2,7 @@
Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy"
spec.version = "5.2.1"
spec.version = "5.3.0"
spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"]

View file

@ -1,6 +1,6 @@
{
"name": "jekyll-theme-chirpy",
"version": "5.2.1",
"version": "5.3.0",
"description": "A minimal, responsive, and powerful Jekyll theme for presenting professional writing.",
"repository": {
"type": "git",

View file

@ -1,160 +0,0 @@
#!/usr/bin/env bash
#
# Build, test and then deploy the site content to 'origin/<pages_branch>'
#
# Requirement: html-proofer, jekyll
#
# Usage: See help information
set -eu
PAGES_BRANCH="gh-pages"
SITE_DIR="_site"
_opt_dry_run=false
_config="_config.yml"
_no_pages_branch=false
_backup_dir="$(mktemp -d)"
_baseurl=""
help() {
echo "Build, test and then deploy the site content to 'origin/<pages_branch>'"
echo
echo "Usage:"
echo
echo " bash ./tools/deploy.sh [options]"
echo
echo "Options:"
echo ' -c, --config "<config_a[,config_b[...]]>" Specify config file(s)'
echo " --dry-run Build site and test, but not deploy"
echo " -h, --help Print this information."
}
init() {
if [[ -z ${GITHUB_ACTION+x} && $_opt_dry_run == 'false' ]]; then
echo "ERROR: It is not allowed to deploy outside of the GitHub Action envrionment."
echo "Type option '-h' to see the help information."
exit -1
fi
_baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
}
build() {
# clean up
if [[ -d $SITE_DIR ]]; then
rm -rf "$SITE_DIR"
fi
# build
JEKYLL_ENV=production bundle exec jekyll b -d "$SITE_DIR$_baseurl" --config "$_config"
}
test() {
bundle exec htmlproofer \
--disable-external \
--check-html \
--allow_hash_href \
"$SITE_DIR"
}
resume_site_dir() {
if [[ -n $_baseurl ]]; then
# Move the site file to the regular directory '_site'
mv "$SITE_DIR$_baseurl" "${SITE_DIR}-rename"
rm -rf "$SITE_DIR"
mv "${SITE_DIR}-rename" "$SITE_DIR"
fi
}
setup_gh() {
if [[ -z $(git branch -av | grep "$PAGES_BRANCH") ]]; then
_no_pages_branch=true
git checkout -b "$PAGES_BRANCH"
else
git checkout -f "$PAGES_BRANCH"
fi
}
backup() {
mv "$SITE_DIR"/* "$_backup_dir"
mv .git "$_backup_dir"
# When adding custom domain from Github website,
# the CANME only exist on `gh-pages` branch
if [[ -f CNAME ]]; then
mv CNAME "$_backup_dir"
fi
}
flush() {
rm -rf ./*
rm -rf .[^.] .??*
shopt -s dotglob nullglob
mv "$_backup_dir"/* .
[[ -f ".nojekyll" ]] || echo "" >".nojekyll"
}
deploy() {
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git update-ref -d HEAD
git add -A
git commit -m "[Automation] Site update No.${GITHUB_RUN_NUMBER}"
if $_no_pages_branch; then
git push -u origin "$PAGES_BRANCH"
else
git push -f
fi
}
main() {
init
build
test
resume_site_dir
if $_opt_dry_run; then
exit 0
fi
setup_gh
backup
flush
deploy
}
while (($#)); do
opt="$1"
case $opt in
-c | --config)
_config="$2"
shift
shift
;;
--dry-run)
# build & test, but not deploy
_opt_dry_run=true
shift
;;
-h | --help)
help
exit 0
;;
*)
# unknown option
help
exit 1
;;
esac
done
main

View file

@ -140,37 +140,6 @@ resume_config() {
mv _config.yml.bak _config.yml
}
# auto-generate a new version number to the file 'package.json'
standard_version() {
if $opt_pre; then
standard-version --prerelease rc
else
standard-version
fi
}
# Prevent changelogs generated on master branch from having duplicate content
# (the another bug of `standard-version`)
standard_version_plus() {
temp_branch="prod-mirror"
temp_dir="$(mktemp -d)"
git checkout -b "$temp_branch" "$PROD_BRANCH"
git merge --no-ff --no-edit "$STAGING_BRANCH"
standard_version
cp package.json CHANGELOG.md "$temp_dir"
git checkout "$STAGING_BRANCH"
git reset --hard HEAD # undo the changes from $temp_branch
mv "$temp_dir"/* . # rewrite the changelog
# clean up the temp stuff
rm -rf "$temp_dir"
git branch -D "$temp_branch"
}
# build a gem package
build_gem() {
echo -e "Build the gem package for v$_version\n"
@ -184,13 +153,13 @@ build_gem() {
release() {
_version="$1" # X.Y.Z
git checkout "$PROD_BRANCH"
git merge --no-ff --no-edit "$working_branch"
# Create a new tag on production branch
# Create a new tag on working branch
echo -e "Create tag v$_version\n"
git tag "v$_version"
git checkout "$PROD_BRANCH"
git merge --no-ff --no-edit "$working_branch"
# merge from patch branch to the staging branch
# NOTE: This may break due to merge conflicts, so it may need to be resolved manually.
if [[ $working_branch == hotfix/* ]]; then
@ -203,15 +172,13 @@ release() {
main() {
check
if [[ "$working_branch" == "$STAGING_BRANCH" ]]; then
standard_version_plus
# auto-generate a new version number to the file 'package.json'
if $opt_pre; then
standard-version --prerelease rc
else
standard_version
standard-version
fi
# Change heading of Patch version to level 2 (a bug from `standard-version`)
sed -i "s/^### \[/## \[/g" CHANGELOG.md
_version="$(grep '"version":' package.json | sed 's/.*: "//;s/".*//')"
echo -e "Bump version number to $_version\n"

67
tools/test.sh Executable file
View file

@ -0,0 +1,67 @@
#!/usr/bin/env bash
#
# Build and test the site content
#
# Requirement: html-proofer, jekyll
#
# Usage: See help information
set -eu
SITE_DIR="_site"
_config="_config.yml"
help() {
echo "Build and test the site content"
echo
echo "Usage:"
echo
echo " bash ./tools/test.sh [options]"
echo
echo "Options:"
echo ' -c, --config "<config_a[,config_b[...]]>" Specify config file(s)'
echo " -h, --help Print this information."
}
main() {
# clean up
if [[ -d $SITE_DIR ]]; then
rm -rf "$SITE_DIR"
fi
_baseurl="$(grep '^baseurl:' "$_config" | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
# build
JEKYLL_ENV=production bundle exec jekyll build \
--destination "$SITE_DIR$_baseurl" \
--config "$_config"
# test
bundle exec htmlproofer "$SITE_DIR" \
--disable-external \
--check-html \
--allow_hash_href
}
while (($#)); do
opt="$1"
case $opt in
-c | --config)
_config="$2"
shift
shift
;;
-h | --help)
help
exit 0
;;
*)
# unknown option
help
exit 1
;;
esac
done
main