diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 00000000000..9f49e06ac01 --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "body-max-line-length": [0, "always"] + } +} diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 389502c6129..9ac13dc1d9e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ # How to Contribute -We want to thank you for sparing time to improve this project! Here are some guidelines for contributing: +We'd like to thank you for sparing time to improve this project! Here are some guidelines for contributing: To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [_Feature Request_](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project. @@ -9,34 +9,57 @@ To ensure that the blog design is not confused, this project does not accept sug Generally, contribute to the project by: 1. Fork this project on GitHub and clone it locally. -2. Create a new branch from the default branch and give it a descriptive name (e.g., `my-new-feature`, `fix-a-bug`). -3. After completing the development, submit a new _Pull Request_. +2. Create a new branch from the default branch and give it a descriptive name (format: `feature/` / `fix/`). +3. After completing the development, submit a new _Pull Request_. Note that the commit message must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), otherwise it will fail the PR check. ## Modifying JavaScript -If your contribution involves JS modification, please read the following sections. +If your contribution involves JavaScript modification, please read the following sections. ### Inline Scripts -If you need to add comments to the inline JS (the JS code between the tags ``), please use `/**/` instead of two slashes `//`. Because the HTML will be compressed by [jekyll-compress-html](https://github.com/penibelst/jekyll-compress-html) during deployment, but it cannot handle the `//` properly. And this will disrupt the structure of the compressed HTML. +If you need to add comments to the inline JavaScript (the code between the HTML tags ``), please use `/* */` instead of two slashes `//`. Because the HTML will be compressed by [jekyll-compress-html](https://github.com/penibelst/jekyll-compress-html) during deployment, but it cannot handle the `//` properly, which will disrupt the structure of the compressed HTML. ### External Scripts -If you need to add or modify JavaScripts in the directory `_javascript`, you need to install [Gulp.js](https://gulpjs.com/docs/en/getting-started/quick-start). +If you need to add/change/delete the JavaScript in the directory `_javascript/`, setting up [`Node.js`](https://nodejs.org/) and [`npx`](https://www.npmjs.com/package/npx) is a requirement. And then install the development dependencies: -During development, real-time debugging can be performed through the following commands: +```console +$ npm i +``` + +During JavaScript development, real-time debugging can be performed through the following commands: + +Firstly, start a Jekyll server: ```console $ bash tools/run.sh ``` -Open another terminal tab and run: +And then open a new terminal tab and run: + +```console +# Type 'Ctrl + C' to stop +$ npx gulp dev +``` + +After debugging, run the command `npx gulp` (without any argument) will automatically output the compressed files to the directory `assets/js/dist/`. + +## Verify the commit messages + +If you want to make sure your commits pass the CI check, you can refer to the following steps. + +Install `commitlint` & `husky`: ```console -$ gulp dev # Type 'Ctrl + C' to stop +$ npm i -g @commitlint/{cli,config-conventional} husky ``` -After debugging, run the command `gulp` (without any argument) will automatically output the compressed files to the directory `assests/js/dist/`. +And then enable `husky`: + +```console +$ husky install +``` --- diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d787801b650..7c79a526fdb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -35,14 +35,15 @@ Steps to reproduce the behavior: -### Software - - -- Ruby version: -- Gem version: -- Bundler version: -- Jekyll version: -- Theme version: +### Environment + +| Command | Version | +|-----------------------------------|---------| +| `ruby -v` | | +| `gem -v` | | +| `bundle -v` | | +| `bundle exec jekyll -v` | | +| `bundle info jekyll-theme-chirpy` | | ### Desktop diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc8083ed62e..dbefeae7e2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'Continuous Integration' +name: 'CI' on: push: branches-ignore: @@ -18,23 +18,20 @@ on: - '**' jobs: - ci: - runs-on: ${{ matrix.os }} + build: + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-latest, macos-latest] - + ruby: [2.5, 2.6, 2.7, 3] steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 # for posts's lastmod - - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Test Site run: bash tools/deploy.sh --dry-run diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 00000000000..1e05511a4d2 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,11 @@ +name: Lint Commit Messages +on: pull_request + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v4 diff --git a/.github/workflows/pages-deploy.yml.hook b/.github/workflows/pages-deploy.yml.hook index e3efcc8b221..81a249e2997 100644 --- a/.github/workflows/pages-deploy.yml.hook +++ b/.github/workflows/pages-deploy.yml.hook @@ -2,7 +2,7 @@ name: 'Automatic build' on: push: branches: - - main + - master paths-ignore: - .gitignore - README.md diff --git a/.gitignore b/.gitignore index 982a22d79ae..d1210a4a876 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ !.editorconfig !.nojekyll !.travis.yml +!.husky +!.commitlintrc.json +!.versionrc.json # bundler cache _site diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 00000000000..40377885466 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no -- commitlint -x $(npm root -g)/@commitlint/config-conventional --edit diff --git a/.travis.yml b/.travis.yml index d0496d82b25..3ee447e5d68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,9 +31,9 @@ jobs: stages: - name: Upgrade - if: branch =~ /^v(\d)+(\.(\d)+){2}$/ OR tag IS present + if: branch = production - name: Starter - if: branch =~ /^v(\d)+(\.(\d)+){2}$/ OR tag IS present + if: branch = production - name: Docs if: branch = docs diff --git a/.versionrc.json b/.versionrc.json new file mode 100644 index 00000000000..4b880d3089e --- /dev/null +++ b/.versionrc.json @@ -0,0 +1,20 @@ +{ + "skip": { + "commit": true, + "tag": true + }, + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Improvements" + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000000..98c19097516 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,44 @@ +# Changelog + +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.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.1.0...v5.2.0) (2022-06-09) + + +### Features + +* add es-ES support to locales ([#533](https://github.com/cotes2020/jekyll-theme-chirpy/issues/533)) ([efe75ad](https://github.com/cotes2020/jekyll-theme-chirpy/commit/efe75adf2784956afb7a0b67f6634b146d9cb03b)) +* add fr-FR support to locales ([#582](https://github.com/cotes2020/jekyll-theme-chirpy/issues/582)) ([94e8144](https://github.com/cotes2020/jekyll-theme-chirpy/commit/94e81447afa457b1a6b7e8f487c47502803556d7)) +* add Vietnamese locale ([#517](https://github.com/cotes2020/jekyll-theme-chirpy/issues/517)) ([171463d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/171463d76da9b7bc25dd327b8f0a868ea79e388b)) +* add pt-BR support to locales ([c2c503f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/c2c503f63336884282b6bda4ec0703d6ae76771b)) +* add option to turn off PWA ([#527](https://github.com/cotes2020/jekyll-theme-chirpy/issues/527)) ([106c981](https://github.com/cotes2020/jekyll-theme-chirpy/commit/106c981bac71e7434204a77e1f0c9c61d6eb1509)) +* **PWA:** add Service Worker update notification ([d127183](https://github.com/cotes2020/jekyll-theme-chirpy/commit/d127183b9774f6321e409acdb66bf8a85d8814be)) +* support showing description of preview image ([2bd6efa](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2bd6efa95a174ac44e30a3af1e57e6f40d6e0e3a)) + + +### Bug Fixes + +* alt is not a valid attribute for 'a' tag ([58928db](https://github.com/cotes2020/jekyll-theme-chirpy/commit/58928dbc9068db4e4cda4371eeae1865920dce6a)) +* assets URL is missing `baseurl` in self-hosted mode ([#591](https://github.com/cotes2020/jekyll-theme-chirpy/issues/591)) ([54124d5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/54124d5134995fce52e4c2fc0a5d4d1743d6264d)) +* correct the `twitter:creator` of Twitter summary card ([96a16c8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/96a16c868ede51e7dfa412de63ffa1e5a49add7f)) +* correctly URL encode share links ([4c1c8d8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4c1c8d8b0eacecbbaa2d522bbdd6430f350ff760)), closes [#496](https://github.com/cotes2020/jekyll-theme-chirpy/issues/496) +* follow paginate_path config for pagination ([6900d9f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6900d9f2bc9380cbda4babf611c6eeff345291af)) +* force checkout of `gh-pages` branch ([#544](https://github.com/cotes2020/jekyll-theme-chirpy/issues/544)) ([5402523](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5402523ae52a3740bcc15df0b226b2612644945d)) +* horizontal scroll for long equations ([#545](https://github.com/cotes2020/jekyll-theme-chirpy/issues/545)) ([30787fc](https://github.com/cotes2020/jekyll-theme-chirpy/commit/30787fc4cf151e955bb7afc26dfd859f1a06fce6)) +* p is not allowed in span ([4f590e2](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4f590e2bba0639751771211bc0d357828ae70404)) +* remove whitespace from avatar URL ([#537](https://github.com/cotes2020/jekyll-theme-chirpy/issues/537)) ([0542b51](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0542b5149c8287dca60e37f46ee36f31b43455e4)) +* resume the preview image SEO tag ([#529](https://github.com/cotes2020/jekyll-theme-chirpy/issues/529)) ([b8d1bcd](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b8d1bcd3dea0abd1afef7ef154a4501fbb18938d)) +* script code should be in head or body, not in between ([2103191](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2103191b2faf714a8e4418c7c347a1f942b51af8)) +* spurious header closing tags ([59e9557](https://github.com/cotes2020/jekyll-theme-chirpy/commit/59e955745f02f9b57c65af70b0979cd4a98bf53f)) +* table bypass refactoring when it contains IAL ([#519](https://github.com/cotes2020/jekyll-theme-chirpy/issues/519)) ([5d85ccb](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5d85ccb9943aac88dbbefebe1c2234cdcbae5c53)) +* **theme mode:** `SCSS` syntax error ([#588](https://github.com/cotes2020/jekyll-theme-chirpy/issues/588)) ([76a1b6a](https://github.com/cotes2020/jekyll-theme-chirpy/commit/76a1b6a068c369138422dcd18ba08ec8cc3749a6)) +* use `jsonify` to generate valid json ([#521](https://github.com/cotes2020/jekyll-theme-chirpy/issues/521)) ([dd9d5a7](https://github.com/cotes2020/jekyll-theme-chirpy/commit/dd9d5a7207b746342d07176d8969dc4f2c380bf2)) +* when the `site.img_cdn` is set to the local path, the preview-image path loses the `baseurl` ([9cefe58](https://github.com/cotes2020/jekyll-theme-chirpy/commit/9cefe58993d9ea3a3a28424e7ffd8e0911567c5c)) + + +### Improvements + +* avoid post pageviews from shifting while loading ([135a16f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/135a16f13ee783d9308669ff9a824847a73c951c)) +* avoid the layout shift for post datetime ([6d35f5f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6d35f5f8da044cfad071628bb53776de03efaae4)) +* **categories:** support singular and plural forms of locale ([#595](https://github.com/cotes2020/jekyll-theme-chirpy/issues/595)) ([35cadf9](https://github.com/cotes2020/jekyll-theme-chirpy/commit/35cadf969dd0161ee62503e242c545f006f7072b)) +* improve the responsive design for ultrawide screens ([#540](https://github.com/cotes2020/jekyll-theme-chirpy/issues/540)) ([5d6e8c5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5d6e8c5ef6aa71b4d2600c5305f6e8ba540557f7)) diff --git a/_config.yml b/_config.yml index a1e018951b2..ad085a8eb5e 100644 --- a/_config.yml +++ b/_config.yml @@ -115,6 +115,9 @@ assets: # only works if `assets.self_host.enabled` is 'true' env: # [development|production] +pwa: + enabled: true # the option for PWA feature + paginate: 10 # ------------ The following options are not recommended to be modified ------------------ diff --git a/_data/authors.yml b/_data/authors.yml new file mode 100644 index 00000000000..f012012135a --- /dev/null +++ b/_data/authors.yml @@ -0,0 +1,17 @@ +## Template › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/advanced-usage.md#setting-author-url +# ------------------------------------- +# {author_id}: +# name: {full name} +# twitter: {twitter_of_author} +# url: {homepage_of_author} +# ------------------------------------- + +cotes: + name: Cotes Chung + twitter: cotes2020 + url: https://github.com/cotes2020/ + +sille_bille: + name: Dinesh Prasanth Moluguwan Krishnamoorthy + twitter: dinesh_MKD + url: https://github.com/SilleBille/ diff --git a/_data/locales/en.yml b/_data/locales/en.yml index 1221776a216..14394a6aec4 100644 --- a/_data/locales/en.yml +++ b/_data/locales/en.yml @@ -20,7 +20,7 @@ tabs: search: hint: search cancel: Cancel - no_results: Oops! No result founds. + no_results: Oops! No results found. panel: lastmod: Recently Updated @@ -44,9 +44,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. - hint_template: :HEAD_BAK to try finding it again, or search for it on the :ARCHIVES_PAGE. - head_back: Head back Home - archives_page: Archives page + +notification: + update_found: A new version of content is available. + update: Update # ----- Posts related labels ----- @@ -74,5 +75,9 @@ post: # categories page categories: - category_measure: categories - post_measure: posts + category_measure: + singular: category + plural: categories + post_measure: + singular: post + plural: posts diff --git a/_data/locales/es-ES.yml b/_data/locales/es-ES.yml new file mode 100644 index 00000000000..ee3a20f9e47 --- /dev/null +++ b/_data/locales/es-ES.yml @@ -0,0 +1,79 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: Entrada + category: Categoría + tag: Etiqueta + +# The tabs of sidebar +tabs: + # format: : + home: Inicio + categories: Categorías + tags: Etiquetas + archives: Archivo + about: Acerca de + +# the text displayed in the search bar & search results +search: + hint: Buscar + cancel: Cancelar + no_results: ¡Oops! No se encuentran resultados. + +panel: + lastmod: Actualizado recientemente + trending_tags: Etiquetas populares + toc: Contenido + +copyright: + # Shown at the bottom of the post + license: + template: Esta entrada está licenciada bajo :LICENSE_NAME por el autor. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: Algunos derechos reservados. + verbose: >- + Salvo que se indique explícitamente, las entradas de este blog están licenciadas + bajo la Creative Commons Attribution 4.0 International (CC BY 4.0) License por el autor. + +meta: Hecho con :PLATFORM usando el tema :THEME. + +not_found: + statment: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. + +notification: + update_found: Hay una nueva versión de contenido disponible. + update: Actualizar + +# ----- Posts related labels ----- + +post: + written_by: Por + posted: Publicado + updated: Actualizado + words: palabras + pageview_measure: visitas + read_time: + unit: min + prompt: ' de lectura' + relate_posts: Lecturas adicionales + share: Compartir + button: + next: Nuevo + previous: Anterior + copy_code: + succeed: ¡Copiado! + share_link: + title: Copiar enlace + succeed: ¡Enlace copiado! + # pinned prompt of posts list on homepage + pin_prompt: Fijado + +# categories page +categories: + category_measure: categorias + post_measure: entradas diff --git a/_data/locales/fr-FR.yml b/_data/locales/fr-FR.yml new file mode 100644 index 00000000000..0d29a87082c --- /dev/null +++ b/_data/locales/fr-FR.yml @@ -0,0 +1,79 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: Post + category: Catégorie + tag: Tag + +# The tabs of sidebar +tabs: + # format: : + home: Accueil + categories: Catégories + tags: Tags + archives: Archives + about: A propos de + +# the text displayed in the search bar & search results +search: + hint: recherche + cancel: Annuler + no_results: Oups ! Aucun résultat trouvé. + +panel: + lastmod: Récemment mis à jour + trending_tags: Tags tendance + toc: Contenu + +copyright: + # Shown at the bottom of the post + license: + template: Cet article est sous licence :LICENSE_NAME par l'auteur. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: Certains droits réservés. + verbose: >- + Sauf mention contraire, les articles de ce site sont publiés sous licence + sous la licence Creative Commons Attribution 4.0 International (CC BY 4.0) par l'auteur. + +meta: Propulsé par :PLATFORM avec le thème :THEME + +not_found: + statment: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. + +notification: + update_found: Une nouvelle version du contenu est disponible. + update: Mise à jour + +# ----- Posts related labels ----- + +post: + written_by: Par + posted: Posté + updated: Mis à jour + words: mots + pageview_measure: vues + read_time: + unit: min + prompt: lire + relate_posts: Autres lectures + share: Partager + button: + next: Plus récent + previous: Plus ancien + copy_code: + succeed: Copié ! + share_link: + title: Copier le lien + succeed: Lien copié avec succès ! + # pinned prompt of posts list on homepage + pin_prompt: Épinglé + +# categories page +categories: + category_measure: catégories + post_measure: posts diff --git a/_data/locales/id-ID.yml b/_data/locales/id-ID.yml index 37ad8eae665..59ec6617062 100644 --- a/_data/locales/id-ID.yml +++ b/_data/locales/id-ID.yml @@ -44,9 +44,10 @@ meta: Didukung oleh :PLATFORM dengan tema :THEME. not_found: statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. - hint_template: :HEAD_BAK untuk mencoba mencari kembali, atau cari di :ARCHIVES_PAGE. - head_back: Kembali ke Beranda - archives_page: Halaman Arsip + +notification: + update_found: Versi konten baru tersedia. + update: Perbarui # ----- Posts related labels ----- diff --git a/_data/locales/ko-KR.yml b/_data/locales/ko-KR.yml index 4bfd318197c..2fb9391b77a 100644 --- a/_data/locales/ko-KR.yml +++ b/_data/locales/ko-KR.yml @@ -44,9 +44,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: 해당 URL은 존재하지 않습니다. - hint_template: :HEAD_BAK을 눌러 다시 찾거나 :ARCHIVES_PAGE에서 검색해 주세요. - head_back: 홈으로 돌아가기 - archives_page: 아카이브 페이지 + +notification: + update_found: 새 버전의 콘텐츠를 사용할 수 있습니다. + update: 업데이트 # ----- Posts related labels ----- diff --git a/_data/locales/my-MM.yml b/_data/locales/my-MM.yml index 6ad9e2818d5..9990c763cad 100644 --- a/_data/locales/my-MM.yml +++ b/_data/locales/my-MM.yml @@ -44,9 +44,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ - hint_template: ၎င်းကို ထပ်မံရှာဖွေရန် :HEAD_BAK , သို့မဟုတ် :ARCHIVES_PAGE တွင်ရှာပါ။ - head_back: အဓိကစာမျက်နှာသို့ပြန်သွားပါ။ - archives_page: မှတ်တမ်း​တိုက် စာမျက်နှာ။ + +notification: + update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။ + update: အပ်ဒိတ် # ----- Posts related labels ----- diff --git a/_data/locales/pt-BR.yml b/_data/locales/pt-BR.yml new file mode 100644 index 00000000000..59209aeec9b --- /dev/null +++ b/_data/locales/pt-BR.yml @@ -0,0 +1,79 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: Post + category: Categoria + tag: Tag + +# The tabs of sidebar +tabs: + # format: : + home: Home + categories: Categorias + tags: Tags + archives: Arquivos + about: Sobre + +# the text displayed in the search bar & search results +search: + hint: Buscar + cancel: Cancelar + no_results: Oops! Nenhum resultado encontrado. + +panel: + lastmod: Atualizados recentemente + trending_tags: Trending Tags + toc: Conteúdo + +copyright: + # Shown at the bottom of the post + license: + template: Esta postagem está licenciada sob :LICENSE_NAME pelo autor. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: Alguns direitos reservados. + verbose: >- + Exceto onde indicado de outra forma, as postagens do blog neste site são licenciadas sob a + Creative Commons Attribution 4.0 International (CC BY 4.0) License pelo autor. + +meta: Feito com :PLATFORM usando o tema :THEME. + +not_found: + statment: Desculpe, a página não foi encontrada. + +notification: + update_found: Uma nova versão do conteúdo está disponível. + update: atualização + +# ----- Posts related labels ----- + +post: + written_by: Por + posted: Postado em + updated: Atualizado + words: palavras + pageview_measure: visualizações + read_time: + unit: min + prompt: " de leitura" + relate_posts: Leia também + share: Compartilhar + button: + next: Próximo + previous: Anterior + copy_code: + succeed: Copiado! + share_link: + title: Copie o link + succeed: Link copiado com sucesso! + # pinned prompt of posts list on homepage + pin_prompt: Fixado + +# categories page +categories: + category_measure: categorias + post_measure: posts diff --git a/_data/locales/ru-RU.yml b/_data/locales/ru-RU.yml index 1a538fe6c62..3cd937c6476 100644 --- a/_data/locales/ru-RU.yml +++ b/_data/locales/ru-RU.yml @@ -44,9 +44,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: Извините, эта ссылка указывает на ресурс который не существует. - hint_template: :HEAD_BAK чтобы снова осуществить поиск, или поищите :ARCHIVES_PAGE. - head_back: Вернитесь на домашнюю страницу - archives_page: архиве + +notification: + update_found: Доступна новая версия контента. + update: Обновлять # ----- Posts related labels ----- diff --git a/_data/locales/uk-UA.yml b/_data/locales/uk-UA.yml index c06faaf3172..6925e42a32a 100644 --- a/_data/locales/uk-UA.yml +++ b/_data/locales/uk-UA.yml @@ -44,9 +44,10 @@ meta: Powered by :PLATFORM with :THEME theme. not_found: statment: Вибачте, це посилання вказує на ресурс, що не існує. - hint_template: :HEAD_BAK аби здійснити пошук, або пошукайте в :ARCHIVES_PAGE. - head_back: Поверніться на домашню сторінку - archives_page: архіві + +notification: + update_found: Доступна нова версія вмісту. + update: Оновлення # ----- Posts related labels ----- diff --git a/_data/locales/vi-VN.yml b/_data/locales/vi-VN.yml new file mode 100644 index 00000000000..592000df18c --- /dev/null +++ b/_data/locales/vi-VN.yml @@ -0,0 +1,77 @@ +# The layout text of site + +# ----- Commons label ----- + +layout: + post: Bài viết + category: Danh mục + tag: Thẻ + +# The tabs of sidebar +tabs: + # format: : + home: Trang chủ + categories: Các danh mục + tags: Các thẻ + archives: Lưu trữ + about: Giới thiệu + +# the text displayed in the search bar & search results +search: + hint: tìm kiếm + cancel: Hủy + no_results: Không có kết quả tìm kiếm. + +panel: + lastmod: Mới cập nhật + trending_tags: Các thẻ thịnh hành + toc: Mục lục + +copyright: + # Shown at the bottom of the post + license: + template: Bài viết này được cấp phép bởi tác giả theo giấy phép :LICENSE_NAME. + name: CC BY 4.0 + link: https://creativecommons.org/licenses/by/4.0/ + + # Displayed in the footer + brief: Một số quyền được bảo lưu. + verbose: >- + Trừ khi có ghi chú khác, các bài viết đăng trên trang này được cấp phép bởi tác giả theo giấy phép Creative Commons Attribution 4.0 International (CC BY 4.0). +meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME. + +not_found: + statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. + +notification: + update_found: Đã có phiên bản mới của nội dung. + update: Cập nhật + +# ----- Posts related labels ----- + +post: + written_by: Viết bởi + posted: Đăng lúc + updated: Cập nhật lúc + words: từ + pageview_measure: lượt xem + read_time: + unit: phút + prompt: đọc + relate_posts: Bài viết liên quan + share: Chia sẻ + button: + next: Mới hơn + previous: Cũ hơn + copy_code: + succeed: Đã sao chép! + share_link: + title: Sao chép đường dẫn + succeed: Đã sao chép đường dẫn thành công! + # pinned prompt of posts list on homepage + pin_prompt: Bài ghim + +# categories page +categories: + category_measure: danh mục + post_measure: bài viết diff --git a/_data/locales/zh-CN.yml b/_data/locales/zh-CN.yml index 880a47ee925..42fcfbc84ca 100644 --- a/_data/locales/zh-CN.yml +++ b/_data/locales/zh-CN.yml @@ -43,9 +43,10 @@ meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。 not_found: statment: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 - hint_template: :HEAD_BAK尝试再次查找它,或在:ARCHIVES_PAGE上搜索它。 - head_back: 返回主页 - archives_page: 归档页面 + +notification: + update_found: 发现新版本的内容。 + update: 更新 # ----- Posts related labels ----- diff --git a/_includes/datetime.html b/_includes/datetime.html new file mode 100644 index 00000000000..47e38bd5993 --- /dev/null +++ b/_includes/datetime.html @@ -0,0 +1,21 @@ + + +{% assign wrap_elem = include.wrap | default: 'em' %} + +{% if site.prefer_datetime_locale == 'en' or lang == 'en' %} + {% assign df_strftime = '%b %e, %Y' %} + {% assign df_dayjs = 'll' %} +{% else %} + {% assign df_strftime = '%F' %} + {% assign df_dayjs = 'YYYY-MM-DD' %} +{% endif %} + +<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}" + data-ts="{{ include.date | date: '%s' }}" + data-df="{{ df_dayjs }}" + {% if include.tooltip %}data-toggle="tooltip" data-placement="bottom"{% endif %}> + {{ include.date | date: df_strftime }} + diff --git a/_includes/footer.html b/_includes/footer.html index 29aa129e591..b6b27de538d 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -1,9 +1,7 @@ - + -
-
+
+
-
+
+
diff --git a/_includes/head.html b/_includes/head.html index 8c85ec9a929..aaa23a091af 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -23,7 +23,30 @@ {% endif %} - {% seo title=false %} + {% capture seo_tags %} + {% seo title=false %} + {% endcapture %} + + {% if site.img_cdn and seo_tags contains 'og:image' %} + {% assign properties = 'og:image,twitter:image' | split: ',' %} + + {% for prop in properties %} + {% if site.img_cdn contains '//' %} + + {% capture target %} {% endfor %} - + {% endif %} @@ -67,24 +90,27 @@ {% endif %} - + - + {% if site.toc and page.toc %} - + {% endif %} {% if page.layout == 'page' or page.layout == 'post' %} - + {% endif %} - + + {% unless site.theme_mode %} + {% include mode-toggle.html %} + {% endunless %} diff --git a/_includes/js-selector.html b/_includes/js-selector.html index c0402bfadbb..acc7791e5c0 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -7,7 +7,7 @@ {% if page.layout == 'post' %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} - + {% endif %} {% endif %} @@ -79,18 +79,22 @@ } }; - - + {% endif %} - + {% if jekyll.environment == 'production' %} - + {% if site.pwa.enabled %} + + {% else %} + + {% endif %} {% if site.google_analytics.id != empty and site.google_analytics.id %} diff --git a/_includes/mermaid.html b/_includes/mermaid.html index 51eea696e6b..e89a12edcb3 100644 --- a/_includes/mermaid.html +++ b/_includes/mermaid.html @@ -2,7 +2,7 @@ mermaid-js loader --> - + + +
{{- site.data.locales[lang].panel.toc -}}
diff --git a/_includes/topbar.html b/_includes/topbar.html index 7db08109a5b..bdd2b5e61d1 100644 --- a/_includes/topbar.html +++ b/_includes/topbar.html @@ -2,8 +2,8 @@ The Top Bar --> -
-
+
+
{% assign paths = page.url | split: '/' %} diff --git a/_javascript/commons/locale-helper.js b/_javascript/commons/locale-helper.js deleted file mode 100644 index 196ca6cb3f2..00000000000 --- a/_javascript/commons/locale-helper.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * A tool for locale datetime - */ - -const LocaleHelper = (function () { - const $preferLocale = $('meta[name="prefer-datetime-locale"]'); - const locale = $preferLocale.length > 0 ? - $preferLocale.attr('content').toLowerCase() : $('html').attr('lang').substr(0, 2); - const attrTimestamp = 'data-ts'; - const attrDateFormat = 'data-df'; - - return { - locale: () => locale, - attrTimestamp: () => attrTimestamp, - attrDateFormat: () => attrDateFormat, - getTimestamp: ($elem) => Number($elem.attr(attrTimestamp)), // unix timestamp - getDateFormat: ($elem) => $elem.attr(attrDateFormat) - }; -}()); diff --git a/_javascript/copyright b/_javascript/copyright index 5f1787d9710..fb4de71eb70 100644 --- a/_javascript/copyright +++ b/_javascript/copyright @@ -1,5 +1,5 @@ /*! - * Chirpy v5.1.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/_javascript/utils/locale-datetime.js b/_javascript/utils/locale-datetime.js index a7766f0e8fd..571dd0f1cd8 100644 --- a/_javascript/utils/locale-datetime.js +++ b/_javascript/utils/locale-datetime.js @@ -4,17 +4,42 @@ * Requirement: */ +/* A tool for locale datetime */ +const LocaleHelper = (function () { + const $preferLocale = $('meta[name="prefer-datetime-locale"]'); + const locale = $preferLocale.length > 0 ? + $preferLocale.attr('content').toLowerCase() : $('html').attr('lang').substr(0, 2); + const attrTimestamp = 'data-ts'; + const attrDateFormat = 'data-df'; + + return { + locale: () => locale, + attrTimestamp: () => attrTimestamp, + attrDateFormat: () => attrDateFormat, + getTimestamp: ($elem) => Number($elem.attr(attrTimestamp)), // unix timestamp + getDateFormat: ($elem) => $elem.attr(attrDateFormat) + }; + +}()); + $(function() { dayjs.locale(LocaleHelper.locale()); dayjs.extend(window.dayjs_plugin_localizedFormat); $(`[${LocaleHelper.attrTimestamp()}]`).each(function () { const date = dayjs.unix(LocaleHelper.getTimestamp($(this))); - const df = LocaleHelper.getDateFormat($(this)); - const text = date.format(df); - + const text = date.format(LocaleHelper.getDateFormat($(this))); $(this).text(text); $(this).removeAttr(LocaleHelper.attrTimestamp()); $(this).removeAttr(LocaleHelper.attrDateFormat()); + + // setup tooltips + const tooltip = $(this).attr('data-toggle'); + if (typeof tooltip === 'undefined' || tooltip !== 'tooltip') { + return; + } + + const tooltipText = date.format('llll'); // see: https://day.js.org/docs/en/display/format#list-of-localized-formats + $(this).attr('data-original-title', tooltipText); }); }); diff --git a/_javascript/utils/timeago.js b/_javascript/utils/timeago.js deleted file mode 100644 index d7746d61081..00000000000 --- a/_javascript/utils/timeago.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Calculate the Timeago - * - * Requirement: - */ - -$(function() { - const attrTimestamp = LocaleHelper.attrTimestamp(); - const attrCapitalize = 'data-capitalize'; - const $timeago = $(".timeago"); - - let timeagoTasks = $timeago.length; - let intervalId = void 0; - - dayjs.locale(LocaleHelper.locale()); - dayjs.extend(window.dayjs_plugin_relativeTime); - dayjs.extend(window.dayjs_plugin_localizedFormat); - - function relativetime($elem) { - const now = dayjs(); - const past = dayjs.unix(LocaleHelper.getTimestamp($elem)); - - let diffMonth = now.diff(past, 'month', true); - if (diffMonth > 10) { // year ago range: 11 months to 17months - $elem.removeAttr(attrTimestamp); - return past.format('ll'); // see: https://day.js.org/docs/en/display/format#list-of-localized-formats - } - - let diffMinute = now.diff(past, 'minute', true); - if (diffMinute > 44) { // an hour ago range: 45 to 89 minutes - $elem.removeAttr(attrTimestamp); - } - - return past.fromNow(); - } - - function updateTimeago() { - $timeago.each(function() { - if (typeof $(this).attr(attrTimestamp) === 'undefined') { - timeagoTasks -= 1; - return; - } - - let relativeTime = relativetime($(this)); - const capitalize = $(this).attr(attrCapitalize); - if (typeof capitalize !== 'undefined' && capitalize === 'true') { - relativeTime = relativeTime.replace(/^\w/, (c) => c.toUpperCase()); - } - - if ($(this).text() !== relativeTime) { - $(this).text(relativeTime); - } - }); - - if (timeagoTasks === 0 && typeof intervalId !== "undefined") { - clearInterval(intervalId); /* stop interval */ - } - - return timeagoTasks; - } - - function setupTooltips() { - $timeago.each(function() { - const tooltip = $(this).attr('data-toggle'); - if (typeof tooltip === 'undefined' || tooltip !== 'tooltip') { - return; - } - - const df = $(this).attr('data-tooltip-df'); - const ts = LocaleHelper.getTimestamp($(this)); - const dateStr = dayjs.unix(ts).format(df); - $(this).attr('data-original-title', dateStr); - $(this).removeAttr('data-tooltip-df'); - }); - } - - if (timeagoTasks === 0) { - return; - } - - setupTooltips(); - - if (updateTimeago()) { /* run immediately */ - intervalId = setInterval(updateTimeago, 60 * 1000); /* run every minute */ - } - -}); diff --git a/_layouts/archives.html b/_layouts/archives.html index 3b77ac8dbad..f70b0d735a5 100644 --- a/_layouts/archives.html +++ b/_layouts/archives.html @@ -3,8 +3,17 @@ # The Archives of posts. --- -
+{% include lang.html %} + +{% if site.prefer_datetime_locale == 'en' or lang == 'en' %} + {% assign df_strftime_m = '%b' %} + {% assign df_dayjs_m = 'MMM' %} +{% else %} + {% assign df_strftime_m = '/ %m' %} + {% assign df_dayjs_m = '/ MM' %} +{% endif %} +
{% for post in site.posts %} {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} {% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %} @@ -17,9 +26,11 @@
  • {% assign ts = post.date | date: '%s' %} - {{ post.date | date: "%d" }} - - {{ post.date | date: '%m' }} + + {{ post.date | date: "%d" }} + + + {{ post.date | date: df_strftime_m }} {{ post.title }}
    diff --git a/_layouts/categories.html b/_layouts/categories.html index 4e9ce771eb1..88c45b08243 100644 --- a/_layouts/categories.html +++ b/_layouts/categories.html @@ -47,10 +47,24 @@ {% if sub_categories_size > 0 %} {{ sub_categories_size }} - {{ site.data.locales[lang].categories.category_measure }}, + {% if sub_categories_size > 1 %} + {{ site.data.locales[lang].categories.category_measure.plural + | default: site.data.locales[lang].categories.category_measure }} + {% else %} + {{ site.data.locales[lang].categories.category_measure.singular + | default: site.data.locales[lang].categories.category_measure }} + {% endif %}, + {% endif %} + + {{ top_posts_size }} + + {% if top_posts_size > 1 %} + {{ site.data.locales[lang].categories.post_measure.plural + | default: site.data.locales[lang].categories.post_measure }} + {% else %} + {{ site.data.locales[lang].categories.post_measure.singular + | default: site.data.locales[lang].categories.post_measure }} {% endif %} - {{ top_posts_size }} - {{ site.data.locales[lang].categories.post_measure }} @@ -83,7 +97,14 @@ {% assign posts_size = site.categories[sub_category] | size %} {{ posts_size }} - {{ site.data.locales[lang].categories.post_measure }} + + {% if posts_size > 1 %} + {{ site.data.locales[lang].categories.post_measure.plural + | default: site.data.locales[lang].categories.post_measure }} + {% else %} + {{ site.data.locales[lang].categories.post_measure.singular + | default: site.data.locales[lang].categories.post_measure }} + {% endif %}
  • {% endfor %} diff --git a/_layouts/category.html b/_layouts/category.html index 689d638bf73..f6ceb5a882e 100644 --- a/_layouts/category.html +++ b/_layouts/category.html @@ -3,6 +3,8 @@ # The Category layout --- +{% include lang.html %} +

    @@ -15,9 +17,7 @@

  • {{ post.title }} - - {{ post.date | date: '%Y-%m-%d' }} - + {% include datetime.html date=post.date wrap='span' class='text-muted small' %}
  • {% endfor %} diff --git a/_layouts/default.html b/_layouts/default.html index 1634cb45d34..3823ba02c10 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -19,18 +19,14 @@ {% include head.html %} - {% unless site.theme_mode %} - {% include mode-toggle.html %} - {% endunless %} - {% include sidebar.html %} {% include topbar.html %} -
    -
    +
    +
    {{ content }} @@ -52,6 +48,23 @@ + {% if site.pwa.enabled %} + + {% endif %} + {% include search-loader.html %} {% include js-selector.html %} diff --git a/_layouts/home.html b/_layouts/home.html index 7963f2d644e..903573bd7b7 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -23,7 +23,6 @@ {% assign pinned_num = 0 %} {% endif %} - {% assign default_beg = offset | minus: pinned.size %} @@ -58,15 +57,11 @@