Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 committed Jan 10, 2024
2 parents 60836af + d6d0098 commit 21d74f1
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 122 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ["3.0", "3.1", "3.2"]

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -28,7 +32,7 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Setup Node
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: "${{ matrix.language }}"

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
2 changes: 1 addition & 1 deletion .github/workflows/pages-deploy.yml.hook
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
ruby-version: 3.2
bundler-cache: true

- name: Build site
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@ permissions:
issues: write
pull-requests: write

env:
STALE_LABEL: stale
EXEMPT_LABELS: "pending,planning,in progress"
MESSAGE: >
This conversation has been automatically marked as stale because it has not had recent activity.
It will be closed if no further activity occurs.
Thank you for your contributions.
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
- uses: actions/stale@v9
with:
days-before-stale: 30
days-before-close: 1
stale-issue-label: stale
exempt-issue-labels: pending
stale-issue-message: >
This issue has been automatically marked as stale because it has not had recent activity.
It will be closed if no further activity occurs.
Thank you for your contributions.
stale-pr-label: stale
exempt-pr-labels: pending
stale-pr-message: >
This PR has been automatically marked as stale because it has not had recent activity.
It will be closed if no further activity occurs.
Thank you for your contributions.
stale-issue-label: ${{ env.STALE_LABEL }}
exempt-issue-labels: ${{ env.EXEMPT_LABELS }}
stale-issue-message: ${{ env.MESSAGE }}
stale-pr-label: ${{ env.STALE_LABEL }}
exempt-pr-labels: ${{ env.EXEMPT_LABELS }}
stale-pr-message: ${{ env.MESSAGE }}
33 changes: 10 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@
[![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)

[**Live Demo**][demo]
[**Live Demo**][demo]

[![Devices Mockup](https://chirpy-img.netlify.app/commons/devices-mockup.png)][demo]

</div>

## Features

<details>
<summary>Click to expand/close details</summary>
&nbsp;

- Dark / Light Theme Mode
- Localized UI language
- Pinned Posts on Home Page
Expand All @@ -41,8 +37,6 @@
- Google Analytics
- SEO & Performance Optimization

</details>

## Documentation

To learn how to use, develop, and upgrade the project, please refer to the [Wiki][wiki].
Expand All @@ -55,22 +49,18 @@ For details, see the "[Contributing Guidelines][contribute-guide]".

## Credits

This project was built primarily with the [Jekyll][jekyllrb] ecosystem,
[Bootstrap][bootstrap], [Font Awesome][icons], and some other [wonderful tools][lib].
The avatar and favicon design from [Clipart Max][image].
### Contributors

Many thanks to the [contributors][contributors] who participated in the development
and to the folks who reported bugs or shared ideas.
Thanks to [all the contributors][contributors] involved in the development of the project!

Last but not least, thanks to [JetBrains][jetbrains] for providing the _Open Source License_.
[![all-contributors](https://contrib.rocks/image?repo=cotes2020/jekyll-theme-chirpy&columns=16)][contributors]
<sub> —— Made with [contrib.rocks](https://contrib.rocks)</sub>

## Sponsoring
### Third-Party Assets

If you like this project or have built something through it, please consider sponsoring it, and your support would be greatly appreciated.
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.

[![Ko-fi](https://img.shields.io/badge/Support_Me_on_Ko--fi-ff5e5b?logo=ko-fi&logoColor=white)][ko-fi]&nbsp;
[![Wechat Pay](https://img.shields.io/badge/Support_Me_on_WeChat-brightgreen?logo=wechat&logoColor=white)][donation]&nbsp;
[![Alipay](https://img.shields.io/badge/Support_Me_on_Alipay-blue?logo=alipay&logoColor=white)][donation]
The avatar and favicon for the project's website are from [ClipartMAX][clipartmax].

## License

Expand All @@ -81,14 +71,11 @@ This project is published under [MIT License][license].
[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/
[bootstrap]: https://getbootstrap.com/
[icons]: https://fontawesome.com/
[image]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/
[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
[ko-fi]: https://ko-fi.com/coteschung/
[donation]: https://sponsor.cotes.page/
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ img_cdn: "https://chirpy-img.netlify.app"
# the avatar on sidebar, support local or CORS resources
avatar: "/commons/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

Expand Down
8 changes: 4 additions & 4 deletions _data/origin/cors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ bootstrap:
js: https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js

toc:
css: https://cdn.jsdelivr.net/npm/tocbot@4.21.3/dist/tocbot.min.css
js: https://cdn.jsdelivr.net/npm/tocbot@4.21.3/dist/tocbot.min.js
css: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.css
js: https://cdn.jsdelivr.net/npm/tocbot@4.25.0/dist/tocbot.min.js

fontawesome:
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/css/all.min.css

search:
js: https://cdn.jsdelivr.net/npm/[email protected]/dest/simple-jekyll-search.min.js

mermaid:
js: https://cdn.jsdelivr.net/npm/[email protected].0/dist/mermaid.min.js
js: https://cdn.jsdelivr.net/npm/[email protected].1/dist/mermaid.min.js

dayjs:
js:
Expand Down
10 changes: 10 additions & 0 deletions _includes/embed/bilibili.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<iframe
class="embed-video bilibili"
loading="lazy"
src="https://player.bilibili.com/player.html?bvid={{ include.id }}"
scrolling="no"
border="0"
frameborder="no"
framespacing="0"
allowfullscreen="true"
></iframe>
49 changes: 28 additions & 21 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- The Head -->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
Expand All @@ -11,29 +9,38 @@
content="width=device-width, user-scalable=no initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
>

{% capture seo_tags %}
{%- capture seo_tags -%}
{% seo title=false %}
{% endcapture %}
{%- endcapture -%}

<!-- Setup Open Graph image -->

{% if page.image %}
{% assign img = 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 %}

{% if site.img_cdn contains '//' %}
<!-- it's a cross-origin URL -->
{% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %}
{% else %}
<!-- it's a local file path -->
{%- capture replacement -%}
"{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
{%- endcapture -%}
{% endif %}

{% assign seo_tags = seo_tags | replace: target, replacement %}
{% assign src = page.image.path | default: page.image %}

{% unless src contains '://' %}
{%- capture img_url -%}
{% include img-url.html src=src img_path=page.img_path %}
{%- endcapture -%}

{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
{%- capture new_url -%}{{ img_url }}{%- endcapture -%}

{% assign seo_tags = seo_tags | replace: old, new %}
{% endunless %}

{% elsif site.social_preview_image %}
{%- capture img_url -%}
{% include img-url.html src=site.social_preview_image %}
{%- endcapture -%}

{%- capture og_image -%}
<meta property="og:image" content="{{ img_url }}" />
{%- endcapture -%}

{% assign old_meta_clip = '<meta name="twitter:card"' %}
{% assign new_meta_clip = og_image | append: old_meta_clip %}
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
{% endif %}

{{ seo_tags }}
Expand Down
24 changes: 24 additions & 0 deletions _includes/img-url.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{%- comment -%}
Generate image final URL based on `site.img_cdn`, `page.img_path`

Arguments:
src - basic image path, required
img_path - relative path of image, optional

Return:
image URL
{%- endcomment -%}

{% assign url = include.src %}

{%- if url -%}
{%- comment -%} CND URL {%- endcomment -%}
{% assign prefix = site.img_cdn | default: '' | relative_url %}

{%- comment -%} Add page image path prefix {%- endcomment -%}
{% assign url = include.img_path | default: '' | append: '/' | append: url %}

{% assign url = prefix | append: '/' | append: url | replace: '///', '/' | replace: '//', '/' | replace: ':', ':/' %}
{%- endif -%}

{{- url -}}
23 changes: 6 additions & 17 deletions _includes/refactor-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,6 @@
{% assign _img_content = null %}
{% assign _img_snippets = _content | split: IMG_TAG %}

<!-- CDN URL -->
{% if site.img_cdn %}
{% if site.img_cdn contains '//' %}
{% assign _path_prefix = site.img_cdn %}
{% else %}
{% assign _path_prefix = site.img_cdn | relative_url %}
{% endif %}
{% else %}
{% assign _path_prefix = site.baseurl %}
{% endif %}

<!-- Add image path -->
{% if page.img_path %}
{% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
{% assign _path_prefix = _path_prefix | append: _path %}
{% endif %}

{% for _img_snippet in _img_snippets %}
{% if forloop.first %}
{% assign _img_content = _img_snippet %}
Expand Down Expand Up @@ -113,6 +96,12 @@
{% assign _final_src = null %}
{% assign _lazyload = true %}

{%- capture _img_url -%}
{% include img-url.html src=_src img_path=page.img_path %}
{%- endcapture -%}

{% assign _path_prefix = _img_url | remove: _src %}

{% unless _src contains '//' %}
{% assign _final_src = _path_prefix | append: _src %}
{% assign _src_alt = 'src="' | append: _path_prefix %}
Expand Down
18 changes: 6 additions & 12 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
<aside aria-label="Sidebar" id="sidebar" class="d-flex flex-column align-items-end">
<header class="profile-wrapper">
<a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
{% if site.avatar != empty and site.avatar %}
{% capture avatar_url %}
{% if site.avatar contains '://' %}
{{ site.avatar }}
{% elsif site.img_cdn != empty and site.img_cdn %}
{{ site.avatar | prepend: site.img_cdn }}
{% else %}
{{ site.avatar | relative_url }}
{% endif %}
{% endcapture %}
<img src="{{ avatar_url | strip }}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
{% endif %}
{%- if site.avatar != empty and site.avatar -%}
{%- capture avatar_url -%}
{% include img-url.html src=site.avatar %}
{%- endcapture -%}
<img src="{{- avatar_url -}}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
{%- endif -%}
</a>

<h1 class="site-title">
Expand Down
15 changes: 8 additions & 7 deletions _includes/update-list.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<!-- Get the last 5 posts from lastmod list. -->
<!-- Get 5 last posted/updated posts -->

{% assign MAX_SIZE = 5 %}

{% assign all_list = '' | split: '' %}

{% for post in site.posts %}
{% if post.last_modified_at and post.last_modified_at != post.date %}
{% capture elem %}
{{- post.last_modified_at | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
{% endcapture %}
{% assign all_list = all_list | push: elem %}
{% endif %}
{% assign datetime = post.last_modified_at | default: post.date %}

{% capture elem %}
{{- datetime | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
{% endcapture %}

{% assign all_list = all_list | push: elem %}
{% endfor %}

{% assign all_list = all_list | sort | reverse %}
Expand Down
6 changes: 5 additions & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ <h1 data-toc-skip>{{ page.title }}</h1>
<em>
{% if authors %}
{% for author in authors %}
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
{% if site.data.authors[author].url -%}
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
{%- else -%}
{{ site.data.authors[author].name }}
{%- endif %}
{% unless forloop.last %}{{ '</em>, <em>' }}{% endunless %}
{% endfor %}
{% else %}
Expand Down
Loading

0 comments on commit 21d74f1

Please sign in to comment.