diff --git a/.github/workflows/pages-deploy.yml b/.github/workflows/pages-deploy.yml index 87089c9..c33b2a6 100644 --- a/.github/workflows/pages-deploy.yml +++ b/.github/workflows/pages-deploy.yml @@ -37,12 +37,12 @@ jobs: - name: Setup Pages id: pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v4 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3 + ruby-version: 3.2 bundler-cache: true - name: Build site @@ -57,7 +57,7 @@ jobs: \-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/" - name: Upload site artifact - uses: actions/upload-pages-artifact@v1 + uses: actions/upload-pages-artifact@v3 with: path: "_site${{ steps.pages.outputs.base_path }}" @@ -70,4 +70,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 diff --git a/Gemfile b/Gemfile index 26c1b0c..aeaacb0 100644 --- a/Gemfile +++ b/Gemfile @@ -20,9 +20,4 @@ gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] # Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem # do not have a Java counterpart. -gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] - -# Lock jekyll-sass-converter to 2.x on Linux-musl -if RUBY_PLATFORM =~ /linux-musl/ - gem "jekyll-sass-converter", "~> 2.0" -end +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] \ No newline at end of file diff --git a/README.md b/README.md index 05bd1ec..1f4210b 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,81 @@ -# Chirpy Starter +
-[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy)][gem]  -[![GitHub license](https://img.shields.io/github/license/cotes2020/chirpy-starter.svg?color=blue)][mit] + # Chirpy Jekyll Theme -When installing the [**Chirpy**][chirpy] theme through [RubyGems.org][gem], Jekyll can only read files in the folders -`_data`, `_layouts`, `_includes`, `_sass` and `assets`, as well as a small part of options of the `_config.yml` file -from the theme's gem. If you have ever installed this theme gem, you can use the command -`bundle info --path jekyll-theme-chirpy` to locate these files. + A minimal, responsive, and feature-rich Jekyll theme for technical writing. -The Jekyll team claims that this is to leave the ball in the user’s court, but this also results in users not being -able to enjoy the out-of-the-box experience when using feature-rich themes. + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)][gem]  + [![CI](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml/badge.svg?branch=master&event=push)][ci]  + [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy]  + [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)][license]  + [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) -To fully use all the features of **Chirpy**, you need to copy the other critical files from the theme's gem to your -Jekyll site. The following is a list of targets: + [**Live Demo** →][demo] -```shell -. -├── _config.yml -├── _plugins -├── _tabs -└── index.html -``` + [![Devices Mockup](https://chirpy-img.netlify.app/commons/devices-mockup.png)][demo] -To save you time, and also in case you lose some files while copying, we extract those files/configurations of the -latest version of the **Chirpy** theme and the [CD][CD] workflow to here, so that you can start writing in minutes. +
-## Prerequisites +## Features -Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of -the basic environment. [Git](https://git-scm.com/) also needs to be installed. +- Dark / Light Theme Mode +- Localized UI language +- Pinned Posts on Home Page +- Hierarchical Categories +- Trending Tags +- Table of Contents +- Last Modified Date +- Syntax Highlighting +- Mathematical Expressions +- Mermaid Diagrams & Flowcharts +- Dark / Light Mode Images +- Embed Videos +- Disqus / Giscus / Utterances Comments +- Built-in Search +- Atom Feeds +- PWA +- Google Analytics / GoatCounter +- SEO & Performance Optimization -## Installation +## Documentation -Sign in to GitHub and [**use this template**][use-template] to generate a brand new repository and name it -`USERNAME.github.io`, where `USERNAME` represents your GitHub username. +To learn how to use, develop, and upgrade the project, please refer to the [Wiki][wiki]. -Then clone it to your local machine and run: +## Contributing -```console -$ bundle -``` +Contributions (_pull requests_, _issues_, and _discussions_) are what make the open-source community such an amazing place +to learn, inspire, and create. Any contributions you make are greatly appreciated. +For details, see the "[Contributing Guidelines][contribute-guide]". -## Usage +## Credits -Please see the [theme's docs](https://github.com/cotes2020/jekyll-theme-chirpy#documentation). +### Contributors + +Thanks to [all the contributors][contributors] involved in the development of the project! + +[![all-contributors](https://contrib.rocks/image?repo=cotes2020/jekyll-theme-chirpy&columns=16)][contributors] + —— Made with [contrib.rocks](https://contrib.rocks) + +### Third-Party Assets + +This project is built on the [Jekyll][jekyllrb] ecosystem and some [great libraries][lib], and is developed using [VS Code][vscode] as well as tools provided by [JetBrains][jetbrains] under a non-commercial open-source software license. + +The avatar and favicon for the project's website are from [ClipartMAX][clipartmax]. ## License -This work is published under [MIT][mit] License. +This project is published under [MIT License][license]. [gem]: https://rubygems.org/gems/jekyll-theme-chirpy -[chirpy]: https://github.com/cotes2020/jekyll-theme-chirpy/ -[use-template]: https://github.com/cotes2020/chirpy-starter/generate -[CD]: https://en.wikipedia.org/wiki/Continuous_deployment -[mit]: https://github.com/cotes2020/chirpy-starter/blob/master/LICENSE +[ci]: https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster +[codacy]: https://app.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade +[license]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE +[jekyllrb]: https://jekyllrb.com/ +[clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/ +[demo]: https://cotes2020.github.io/chirpy-demo/ +[wiki]: https://github.com/cotes2020/jekyll-theme-chirpy/wiki +[contribute-guide]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md +[contributors]: https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors +[lib]: https://github.com/cotes2020/chirpy-static-assets +[vscode]: https://code.visualstudio.com/ +[jetbrains]: https://www.jetbrains.com/?from=jekyll-theme-chirpy \ No newline at end of file diff --git a/_config.yml b/_config.yml index d95ed69..4841580 100644 --- a/_config.yml +++ b/_config.yml @@ -4,10 +4,6 @@ id: 'blog-dev' # Import the theme theme: jekyll-theme-chirpy -# Change the following value to '/PROJECT_NAME' ONLY IF your site type is GitHub Pages Project sites -# and doesn't have a custom domain. -baseurl: "/blog" - # The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm # If it has the same name as one of the files in folder `_data/locales`, the layout language will also be changed, # otherwise, the layout language will use the default value of 'en'. @@ -26,7 +22,8 @@ tagline: Only Blogging Nothing More or Less # it will display as the sub-title description: >- # used by seo meta and the atom feed Through my articles and stories, I hope to guide you through the intricate world of technology, offer insights into automation's transformative power, unveil the secrets behind successful DIY projects, and encourage you to fearlessly pursue new skills. -# fill in the protocol & hostname for your site, e.g., 'https://username.github.io' +# Fill in the protocol & hostname for your site. +# e.g. 'https://username.github.io', note that it does not end with a '/'. url: "http://localhost:4000" github: @@ -56,6 +53,9 @@ google_site_verification: # fill in to your verification string google_analytics: id: G-W2VG43SN3N # fill in your Google Analytics ID +goatcounter: + id: # fill in your Goatcounter ID + # Prefer color scheme setting. # # Note: Keep empty will follow the system prefer color by default, @@ -67,7 +67,7 @@ google_analytics: # light - Use the light color scheme # dark - Use the dark color scheme # -theme_mode: # [light|dark] +theme_mode: # [light | dark] # The CDN endpoint for images. # Notice that once it is assigned, the CDN url @@ -79,6 +79,10 @@ img_cdn: # the avatar on sidebar, support local or CORS resources avatar: /assets/img/avatar.jpg +# The URL of the site-wide social preview image used in SEO `og:image` meta tag. +# It can be overridden by a customized `page.image` in front matter. +social_preview_image: # string, local or CORS resources + # boolean type, the global switch for TOC in posts. toc: true @@ -111,13 +115,23 @@ assets: enabled: # boolean, keep empty means false # specify the Jekyll environment, empty means both # only works if `assets.self_host.enabled` is 'true' - env: # [development|production] + env: # [development | production] pwa: - enabled: true # the option for PWA feature + enabled: true # the option for PWA feature (installable) + cache: + enabled: true # the option for PWA offline cache + # Paths defined here will be excluded from the PWA cache. + # Usually its value is the `baseurl` of another website that + # shares the same domain name as the current website. + deny_paths: + # - "/example" # URLs match `/example/*` will not be cached by the PWA paginate: 10 +# The base URL of your site +baseurl: "/blog" + # ------------ The following options are not recommended to be modified ------------------ kramdown: @@ -157,10 +171,6 @@ defaults: values: layout: page permalink: /:title/ - - scope: - path: assets/img/favicons - values: - swcache: true - scope: path: assets/js/dist values: @@ -184,7 +194,6 @@ exclude: - docs - tools - README.md - - CHANGELOG.md - LICENSE - rollup.config.js - package*.json diff --git a/_data/locales/en.yml b/_data/locales/en.yml index 7c3b9af..e982869 100644 --- a/_data/locales/en.yml +++ b/_data/locales/en.yml @@ -40,7 +40,7 @@ copyright: Except where otherwise noted, the blog posts on this site are licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author. -meta: Using the :PLATFORM theme :THEME +meta: Using the :THEME theme for :PLATFORM. not_found: statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. diff --git a/_data/share.yml b/_data/share.yml index 9f3db43..ee8e6e8 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -23,3 +23,16 @@ platforms: # - type: Weibo # icon: "fab fa-weibo" # link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL" + # + # - type: Mastodon + # icon: "fa-brands fa-mastodon" + # # See: https://github.com/justinribeiro/share-to-mastodon#properties + # instances: + # - label: mastodon.social + # link: "https://mastodon.social/" + # - label: mastodon.online + # link: "https://mastodon.online/" + # - label: fosstodon.org + # link: "https://fosstodon.org/" + # - label: photog.social + # link: "https://photog.social/" \ No newline at end of file diff --git a/_drafts/2024-03-12-yaml-mcq.yml b/_drafts/2024-03-12-yaml-mcq.yml new file mode 100644 index 0000000..c6eca61 --- /dev/null +++ b/_drafts/2024-03-12-yaml-mcq.yml @@ -0,0 +1,25 @@ +title: This is the Quiz Title +randomized: false +questions: + + - type: "multiple-choice" + question: "What is your favorite color?" + items: + - choice: Red + correct: null + - choice: Blue + correct: null + - choice: Green + correct: null + followup: There is no correct answer to asking your favorite color! All choices would be good. + + - type: "multiple-choice" + question: "True or False, Pittsburgh is West of Philadelphia" + items: + - choice: True + correct: true + - choice: False + correct: false + followup: | + The answer is True! Pittsburgh is 304.9 miles West of Philadelphia, or approximately + a car ride of 4 hours and 52 minutes. Buckle up! \ No newline at end of file diff --git a/_includes/head.html b/_includes/head.html index cc4d46b..07ecd37 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -9,29 +9,43 @@ - {% capture seo_tags %} - {% seo title=false %} - {% endcapture %} + {%- capture seo_tags -%} + {% seo title=false %} + {%- endcapture -%} + + {% if page.image %} - {% assign img = page.image.path | default: page.image %} + {% assign src = page.image.path | default: page.image %} - {% unless img contains '://' %} - {% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %} - {% capture target %}"{{ img | absolute_url }}"{% endcapture %} + {% unless src contains '://' %} + {%- capture img_url -%} + {% include img-url.html src=src img_path=page.img_path absolute=true %} + {%- endcapture -%} - {% if site.img_cdn contains '//' %} - - {% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %} - {% else %} - - {%- capture replacement -%} - "{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}" - {%- endcapture -%} - {% endif %} + {%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%} + {%- capture new_url -%}{{ img_url }}{%- endcapture -%} - {% assign seo_tags = seo_tags | replace: target, replacement %} - {% endunless %} + {% assign seo_tags = seo_tags | replace: old_url, new_url %} + {% endunless %} + + {% elsif site.social_preview_image %} + {%- capture img_url -%} + {% include img-url.html src=site.social_preview_image absolute=true %} + {%- endcapture -%} + + {%- capture og_image -%} + + {%- endcapture -%} + + {%- capture twitter_image -%} + + + {%- endcapture -%} + + {% assign old_meta_clip = '' %} + {% assign new_meta_clip = og_image | append: twitter_image %} + {% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %} {% endif %} {{ seo_tags }} @@ -67,7 +81,7 @@ {% endif %} - + @@ -78,6 +92,10 @@ {% endif %} + {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %} + + {% endif %} + {% if page.layout == 'page' or page.layout == 'post' %} diff --git a/_layouts/default.html b/_layouts/default.html index 4f35847..19efb13 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,6 +1,5 @@ --- layout: compress -# Default layout --- @@ -8,15 +7,8 @@ layout: compress {% include origin-type.html %} {% include lang.html %} - -{% capture prefer_mode %} {% if site.theme_mode %} -data-mode="{{ site.theme_mode }}" -{% endif %} -{% endcapture %} - -{% if layout.tail_includes %} - {% assign has_tail = true %} + {% capture prefer_mode %}data-mode="{{ site.theme_mode }}"{% endcapture %} {% endif %} @@ -35,19 +27,20 @@ data-mode="{{ site.theme_mode }}" {% include sidebar.html lang=lang %}
-
+
{% include topbar.html lang=lang %} -
-
- {{ content }} +
+
+ {% if layout.refactor or layout.layout == 'default' %} + {% include refactor-content.html content=content lang=lang %} + {% else %} + {{ content }} + {% endif %}
-
+ +
{{ content }}
- {% if page.categories.size > 0 %} - + {% endif %} {% if page.tags.size > 0 %} - + {% endif %} -
+
- {% if site.data.locales[lang].copyright.license.template %} - - {% capture _replacement %} + {% capture _replacement %} {{ site.data.locales[lang].copyright.license.name }} {% endcapture %} - {{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }} - + {{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }} {% endif %}
{% include post-sharing.html lang=lang %} - -
- -
\ No newline at end of file +
+ +
+ + \ No newline at end of file