Compare commits

...

35 Commits

Author SHA1 Message Date
Azamat Mambetov 9f8aeaadbf
refactor!: rename media-url file and related parameters (#1651)
- Changed variable `img_cdn` to `cdn` in site configuration file.
- Changed the variable defining the relative path of the image in the post from `img_url` to `media_subpath`
2024-04-13 05:14:55 +08:00
Filippo 61bdca2db4
feat(analytics): add Umami and Matomo tracking codes (#1658) 2024-04-09 22:57:06 +08:00
Azamat Mambetov 23be4162b3
feat(media): support audio and video tag with multi sources (#1618) 2024-04-05 00:54:50 +08:00
Cotes Chung 01076cb1c2
build(deps-dev): bump the npm group with 2 updates
Updates `rollup` to 4.13.2
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.13.0...v4.13.2)

Updates `stylelint` to 16.3.1
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/16.2.1...16.3.1)
2024-04-03 05:14:33 +08:00
Cotes Chung 3cc1510071
build(deps): update `wagoid/commitlint-github-action` from 5 to 6
Bumps the gh-actions group with 1 update: [wagoid/commitlint-github-action](https://github.com/wagoid/commitlint-github-action).

Updates `wagoid/commitlint-github-action` from 5 to 6
- [Changelog](https://github.com/wagoid/commitlint-github-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/wagoid/commitlint-github-action/compare/v5...v6)
2024-04-03 05:12:44 +08:00
Mascari4615 950839175a
refactor: fix reference to comment parameter `site.comments.provider` (#1629) 2024-03-25 00:57:43 +08:00
Cotes Chung 13bf51e03d
chore(editor): update markdown extension settings 2024-03-24 02:35:48 +08:00
Cotes Chung ce96d7e251
Merge branch 'production' 2024-03-24 02:31:04 +08:00
Cotes Chung 7a7818b579
chore(release): 6.5.5 2024-03-24 02:31:02 +08:00
Cotes Chung cef8a97384
Merge branch 'hotfix/6.5.5' into production 2024-03-24 02:31:00 +08:00
Cotes Chung 2d649aae0e
fix(post): correct the image URLs (#1627) 2024-03-24 02:28:28 +08:00
Cotes Chung b7aa05d03a
docs: add `v6.5.3` changelog 2024-03-24 02:26:58 +08:00
Cotes Chung c5d5e1f75a
build(deps-dev): bump the npm group with 7 updates
Updates `@babel/core` to 7.24.3
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.3/packages/babel-core)

Updates `@babel/plugin-transform-class-properties` to 7.24.1
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.1/packages/babel-plugin-transform-class-properties)

Updates `@babel/preset-env` to 7.24.3
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.3/packages/babel-preset-env)

Updates `@commitlint/cli` to 19.2.1
- [Release notes](https://github.com/conventional-changelog/commitlint/releases)
- [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/cli/CHANGELOG.md)
- [Commits](https://github.com/conventional-changelog/commitlint/commits/v19.2.1/@commitlint/cli)

Updates `@commitlint/config-conventional` to 19.1.0
- [Release notes](https://github.com/conventional-changelog/commitlint/releases)
- [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/CHANGELOG.md)
- [Commits](https://github.com/conventional-changelog/commitlint/commits/v19.1.0/@commitlint/config-conventional)

Updates `rollup` to 4.13.0
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.12.0...v4.13.0)

Updates `rollup-plugin-license` to 3.3.1
- [Changelog](https://github.com/mjeanroy/rollup-plugin-license/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mjeanroy/rollup-plugin-license/compare/v3.2.0...v3.3.1)
2024-03-23 08:01:23 +08:00
Cotes Chung 319a082940
refactor(post): reduce the margin between title and description 2024-03-23 03:52:13 +08:00
Cotes Chung 6044df4ff1
Merge branch 'production' 2024-03-23 03:42:00 +08:00
GetOutOfMyBakery 700fd5bad7
feat: add support for giscus strict title matching (#1614) 2024-03-18 19:08:05 +08:00
Small Long 8e5fbb7a74
fix: use `https` for Weibo sharing URL (#1612) 2024-03-18 18:54:37 +08:00
Azamat Mambetov 834931486d
feat: display theme version in footer (#1611) 2024-03-18 18:52:33 +08:00
Alexander Fuks f865336c89
feat: make post description customizable (#1602)
---------

Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
2024-03-18 18:50:05 +08:00
Cotes Chung 0f8e782bfd
Merge branch 'production' 2024-03-08 04:12:38 +08:00
Neil Boyd 547b95cc7a
feat(i18n): allow `page.lang` to override `site.lang` (#1586) 2024-03-05 03:09:39 +08:00
Cotes Chung 2a7b56bb36
build(deps-dev): bump the npm group with 5 updates
Updates `@babel/core` to 7.24.0
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.0/packages/babel-core)

Updates `@babel/preset-env` to 7.24.0
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.0/packages/babel-preset-env)

Updates `@commitlint/cli` from 18.6.1 to 19.0.3
- [Release notes](https://github.com/conventional-changelog/commitlint/releases)
- [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/cli/CHANGELOG.md)
- [Commits](https://github.com/conventional-changelog/commitlint/commits/v19.0.3/@commitlint/cli)

Updates `@commitlint/config-conventional` from 18.6.2 to 19.0.3
- [Release notes](https://github.com/conventional-changelog/commitlint/releases)
- [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/CHANGELOG.md)
- [Commits](https://github.com/conventional-changelog/commitlint/commits/v19.0.3/@commitlint/config-conventional)

Updates `rollup` to 4.12.0
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.10.0...v4.12.0)

Close #1580
2024-03-04 18:06:06 +08:00
Cotes Chung 25c4166722
style(markdown): resolve `markdownlint` warnings 2024-03-02 02:14:17 +08:00
Cotes Chung 25b2ffa9ba
build: configure rules for `markdownlint` 2024-03-02 02:07:35 +08:00
Cotes Chung 8a2afae6ca
fix: search result prompt is empty (#1583) 2024-03-01 20:06:34 +08:00
Alexander Fuks 6112b15b8e
refactor: change alternate url for embed video file (#1579) 2024-02-29 23:55:30 +03:00
Alexander Fuks e24a0c73ba
refactor: use explicit url for goatcounter (#1578) 2024-02-29 23:01:10 +03:00
Cotes Chung 0f5abc82a2
Merge branch 'production' 2024-03-01 03:51:26 +08:00
Alexander Fuks 4ddd5c4370
perf: improve <hr> visibility in dark mode (#1565) 2024-02-28 19:58:20 +03:00
Alexander Fuks 9592146ca3
feat: add support for embed video files (#1558) 2024-02-27 23:51:33 +03:00
Cotes Chung 8a1568c27a
Merge branch 'production' 2024-02-27 02:44:32 +08:00
Cotes Chung f8390d4384
perf!: rename comment setting parameter (#1563)
Rename `site.comments.active` to `site.comments.provider`
2024-02-27 01:39:04 +08:00
Alexander Fuks e4363871b5
feat: change site verification settings (#1561) 2024-02-26 22:17:18 +08:00
Alexander Fuks b641b3f1f2
feat(analytics)!: add post pageviews for GoatCounter (#1543)
---------

Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
2024-02-26 02:50:41 +08:00
Dongee Seo 5dbda0c09f
build(deps-dev): replace the deprecated libraries (#1559)
Replace `@babel/plugin-proposal-class-properties` with `@babel/plugin-transform-class-properties`

See: https://www.npmjs.com/package/@babel/plugin-proposal-class-properties
2024-02-25 20:30:21 +08:00
50 changed files with 526 additions and 184 deletions

View File

@ -8,4 +8,4 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
- uses: wagoid/commitlint-github-action@v6

8
.markdownlint.json Normal file
View File

@ -0,0 +1,8 @@
{
"commands-show-output": false,
"blanks-around-fences": false,
"line-length": false,
"no-inline-html": {
"allowed_elements": ["kbd", "sub"]
}
}

View File

@ -7,6 +7,7 @@
// Common formatter
"esbenp.prettier-vscode",
"foxundermoon.shell-format",
"stylelint.vscode-stylelint"
"stylelint.vscode-stylelint",
"yzhang.markdown-all-in-one"
]
}

View File

@ -7,6 +7,9 @@
"files.associations": {
"*.html": "liquid"
},
"[markdown]": {
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
},
// Formatter
"[html][liquid]": {
"editor.defaultFormatter": "Shopify.theme-check-vscode"

View File

@ -1,5 +1,7 @@
<!-- markdownlint-disable-next-line -->
<div align="center">
<!-- markdownlint-disable-next-line -->
# Chirpy Jekyll Theme
A minimal, responsive, and feature-rich Jekyll theme for technical writing.
@ -34,7 +36,7 @@
- Built-in Search
- Atom Feeds
- PWA
- Google Analytics / GoatCounter
- Web Analytics
- SEO & Performance Optimization
## Documentation

View File

@ -44,16 +44,34 @@ social:
# - https://www.facebook.com/username
# - https://www.linkedin.com/in/username
google_site_verification: # fill in to your verification string
# Site Verification Settings
webmaster_verifications:
google: # fill in your Google verification code
bing: # fill in your Bing verification code
alexa: # fill in your Alexa verification code
yandex: # fill in your Yandex verification code
baidu: # fill in your Baidu verification code
facebook: # fill in your Facebook verification code
# ↑ --------------------------
# The end of `jekyll-seo-tag` settings
google_analytics:
id: # fill in your Google Analytics ID
# Web Analytics Settings
analytics:
google:
id: # fill in your Google Analytics ID
goatcounter:
id: # fill in your GoatCounter ID
umami:
id: # fill in your Umami ID
domain: # fill in your Umami domain
matomo:
id: # fill in your Matomo ID
domain: # fill in your Matomo domain
goatcounter:
id: # fill in your Goatcounter ID
# Pageviews settings
pageviews:
provider: # now only supports 'goatcounter'
# Prefer color scheme setting.
#
@ -68,12 +86,12 @@ goatcounter:
#
theme_mode: # [light | dark]
# The CDN endpoint for images.
# The CDN endpoint for media resources.
# Notice that once it is assigned, the CDN url
# will be added to all image (site avatar & posts' images) paths starting with '/'
# will be added to all media resources (site avatar, posts' images, audio and video files) paths starting with '/'
#
# e.g. 'https://cdn.com'
img_cdn: "https://chirpy-img.netlify.app"
cdn: "https://chirpy-img.netlify.app"
# the avatar on sidebar, support local or CORS resources
avatar: "/commons/avatar.jpg"
@ -86,8 +104,9 @@ social_preview_image: # string, local or CORS resources
toc: true
comments:
active: # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable
# The active options are as follows:
# Global switch for the post comment system. Keeping it empty means disabled.
provider: # [disqus | utterances | giscus]
# The provider options are as follows:
disqus:
shortname: # fill with the Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname
# utterances settings https://utteranc.es/
@ -101,6 +120,7 @@ comments:
category:
category_id:
mapping: # optional, default to 'pathname'
strict: # optional, default to '0'
input_position: # optional, default to 'bottom'
lang: # optional, default to the value of `site.lang`
reactions_enabled: # optional, default to the value of `1`

18
_data/media.yml Normal file
View File

@ -0,0 +1,18 @@
- extension: mp3
mime_type: mpeg
- extension: mov
mime_type: quicktime
- extension: avi
mime_type: x-msvideo
- extension: mkv
mime_type: x-matroska
- extension: ogv
mime_type: ogg
- extension: weba
mime_type: webm
- extension: 3gp
mime_type: 3gpp
- extension: 3g2
mime_type: 3gpp2
- extension: mid
mime_type: midi

View File

@ -13,7 +13,7 @@ cdns:
# fonts
webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;700;900&display=swap
webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Source+Sans+Pro:wght@400;600;700;900&display=swap
# Libraries

View File

@ -22,7 +22,7 @@ platforms:
#
# - type: Weibo
# icon: "fab fa-weibo"
# link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL"
# link: "https://service.weibo.com/share/share.php?title=TITLE&url=URL"
#
# - type: Mastodon
# icon: "fa-brands fa-mastodon"

View File

@ -0,0 +1,6 @@
<!-- GoatCounter -->
<script
async
src="https://gc.zgo.at/count.js"
data-goatcounter="https://{{ site.analytics.goatcounter.id }}.goatcounter.com/count"
></script>

View File

@ -0,0 +1,13 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.id }}"></script>
<script>
document.addEventListener('DOMContentLoaded', function (event) {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '{{ site.analytics.google.id }}');
});
</script>

View File

@ -0,0 +1,14 @@
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//{{ site.analytics.matomo.domain }}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', {{ site.analytics.matomo.id }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->

View File

@ -0,0 +1,6 @@
<!-- Umami -->
<script
defer
src="{{ site.analytics.umami.domain }}/script.js"
data-website-id="{{ site.analytics.umami.id }}"
></script>

View File

@ -1,5 +1,5 @@
<!-- The comments switcher -->
{% if page.comments and site.comments.active %}
{% capture path %}comments/{{ site.comments.active }}.html{% endcapture %}
<!-- The comments switcher -->
{% if page.comments and site.comments.provider %}
{% capture path %}comments/{{ site.comments.provider }}.html{% endcapture %}
{% include {{ path }} %}
{% endif %}

View File

@ -25,6 +25,7 @@
'data-category': '{{ site.comments.giscus.category }}',
'data-category-id': '{{ site.comments.giscus.category_id }}',
'data-mapping': '{{ site.comments.giscus.mapping | default: 'pathname' }}',
'data-strict' : '{{ site.comments.giscus.strict | default: '0' }}',
'data-reactions-enabled': '{{ site.comments.giscus.reactions_enabled | default: '1' }}',
'data-emit-metadata': '0',
'data-theme': initTheme,

View File

@ -0,0 +1,35 @@
{% assign src = include.src | strip %}
{% assign title = include.title | strip %}
{% assign types = include.types | default: '' | strip | split: '|' %}
{% unless src contains '://' %}
{%- capture src -%}
{% include media-url.html src=src %}
{%- endcapture -%}
{% endunless %}
<p>
<audio class="embed-audio" controls>
{% assign extension = src | split: '.' | last %}
{% assign types = extension | concat: types %}
{% assign ext_size = extension | size %}
{% assign src_size = src | size %}
{% assign slice_size = src_size | minus: ext_size %}
{% assign filepath = src | slice: 0, slice_size %}
{% for type in types %}
{% assign src = filepath | append: type %}
{% assign media_item = site.data.media | find: 'extension', type %}
{% assign mime_type = media_item.mime_type | default: type %}
<source src="{{ src }}" type="audio/{{ mime_type }}">
{% endfor %}
Your browser does not support the audio tag. Here is a
<a href="{{ src | strip }}">link to the audio file</a> instead.
</audio>
{% if title %}
<em>{{ title }}</em>
{% endif %}
</p>

View File

@ -1,10 +1,9 @@
<iframe
class="embed-video bilibili"
class="embed-video"
loading="lazy"
src="https://player.bilibili.com/player.html?bvid={{ include.id }}"
scrolling="no"
border="0"
frameborder="no"
frameborder="0"
framespacing="0"
allowfullscreen="true"
></iframe>
></iframe>

View File

@ -0,0 +1,59 @@
{% assign video_url = include.src %}
{% assign title = include.title %}
{% assign poster_url = include.poster %}
{% assign types = include.types | default: '' | strip | split: '|' %}
{% unless video_url contains '://' %}
{%- capture video_url -%}
{% include media-url.html src=video_url %}
{%- endcapture -%}
{% endunless %}
{% if poster_url %}
{% unless poster_url contains '://' %}
{%- capture poster_url -%}
{% include media-url.html src=poster_url subpath=page.media_subpath %}
{%- endcapture -%}
{% endunless %}
{% assign poster = 'poster="' | append: poster_url | append: '"' %}
{% endif %}
{% assign attributes = 'controls' %}
{% if include.autoplay %}
{% assign attributes = attributes | append: ' ' | append: 'autoplay' %}
{% endif %}
{% if include.loop %}
{% assign attributes = attributes | append: ' ' | append: 'loop' %}
{% endif %}
{% if include.muted %}
{% assign attributes = attributes | append: ' ' | append: 'muted' %}
{% endif %}
<p>
<video class="embed-video file" {{ poster }} {{ attributes }}>
{% assign extension = video_url | split: '.' | last %}
{% assign types = extension | concat: types %}
{% assign ext_size = extension | size %}
{% assign src_size = video_url | size %}
{% assign slice_size = src_size | minus: ext_size %}
{% assign filepath = video_url | slice: 0, slice_size %}
{% for type in types %}
{% assign src = filepath | append: type %}
{% assign media_item = site.data.media | find: 'extension', type %}
{% assign mime_type = media_item.mime_type | default: type %}
<source src="{{ src }}" type="video/{{ mime_type }}">
{% endfor %}
Your browser does not support the video tag. Here is a
<a href="{{ video_url | strip }}">link to the video file</a> instead.
</video>
{% if title %}
<em>{{ title }}</em>
{% endif %}
</p>

View File

@ -1,5 +1,5 @@
<iframe
class="embed-video youtube"
class="embed-video"
loading="lazy"
src="https://www.youtube.com/embed/{{ include.id }}"
title="YouTube video player"

View File

@ -34,7 +34,14 @@
{%- endcapture -%}
{%- capture _theme -%}
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
<a
data-bs-toggle="tooltip"
data-bs-placement="top"
title="v{{ theme.version }}"
href="https://github.com/cotes2020/jekyll-theme-chirpy"
target="_blank"
rel="noopener"
>Chirpy</a>
{%- endcapture -%}
{{ site.data.locales[include.lang].meta | replace: ':PLATFORM', _platform | replace: ':THEME', _theme }}

View File

@ -1,8 +0,0 @@
<!-- GoatCounter -->
<script
data-goatcounter="https://{{ site.goatcounter.id }}.goatcounter.com/count"
async
src="https://gc.zgo.at/count.js"
></script>

View File

@ -1,14 +0,0 @@
<!--
The GA snippet
-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ site.google_analytics.id }}');
});
</script>

View File

@ -20,7 +20,7 @@
{% unless src contains '://' %}
{%- capture img_url -%}
{% include img-url.html src=src img_path=page.img_path absolute=true %}
{% include media-url.html src=src subpath=page.media_subpath absolute=true %}
{%- endcapture -%}
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
@ -31,7 +31,7 @@
{% elsif site.social_preview_image %}
{%- capture img_url -%}
{% include img-url.html src=site.social_preview_image absolute=true %}
{% include media-url.html src=site.social_preview_image absolute=true %}
{%- endcapture -%}
{%- capture og_image -%}
@ -72,7 +72,7 @@
{% endif %}
<!-- GA -->
{% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.id %}
{% if jekyll.environment == 'production' and site.analytics.google.id != empty and site.analytics.google.id %}
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials">
<link rel="dns-prefetch" href="https://www.google-analytics.com">

View File

@ -1,41 +0,0 @@
{%- comment -%}
Generate image final URL based on `site.img_cdn`, `page.img_path`
Arguments:
src - required, basic image path
img_path - optional, relative path of image
absolute - optional, boolean, if true, generate absolute URL
Return:
image URL
{%- endcomment -%}
{% assign url = include.src %}
{%- if url -%}
{% unless url contains ':' %}
{%- comment -%} Add page image path prefix {%- endcomment -%}
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
{%- comment -%} CND URL {%- endcomment -%}
{% if site.img_cdn %}
{% assign url = site.img_cdn
| append: '/'
| append: url
| replace: '///', '/'
| replace: '//', '/'
| replace: ':/', '://'
%}
{% unless site.img_cdn contains ':' %}
{% if include.absolute %}
{% assign url = site.url | append: site.baseurl | append: url %}
{% else %}
{% assign url = site.baseurl | append: url %}
{% endif %}
{% endunless %}
{% endif %}
{% endunless %}
{%- endif -%}
{{- url -}}

View File

@ -33,7 +33,7 @@
or page.layout == 'category'
or page.layout == 'tag'
%}
{% assign locale = site.lang | split: '-' | first %}
{% assign locale = include.lang | split: '-' | first %}
{% assign urls = urls
| append: ','
@ -95,19 +95,32 @@
<script id="MathJax-script" async src="{{ site.data.origin[type].mathjax.js | relative_url }}"></script>
{% endif %}
<!-- Pageviews -->
{% if page.layout == 'post' %}
{% assign provider = site.pageviews.provider %}
{% if provider and provider != empty %}
{% case provider %}
{% when 'goatcounter' %}
{% if site.analytics[provider].id != empty and site.analytics[provider].id %}
{% include pageviews/{{ provider }}.html %}
{% endif %}
{% endcase %}
{% endif %}
{% endif %}
{% if jekyll.environment == 'production' %}
<!-- PWA -->
{% if site.pwa.enabled %}
<script defer src="{{ 'app.min.js' | prepend: js_dist | relative_url }}"></script>
{% endif %}
<!-- GA -->
{% if site.google_analytics.id != empty and site.google_analytics.id %}
{% include google-analytics.html %}
{% endif %}
<!-- GoatCounter -->
{% if site.goatcounter.id != empty and site.goatcounter.id %}
{% include goatcounter.html %}
{% endif %}
<!-- Web Analytics -->
{% for analytics in site.analytics %}
{% capture str %}{{ analytics }}{% endcapture %}
{% assign type = str | split: '{' | first %}
{% if site.analytics[type].id and site.analytics[type].id != empty %}
{% include analytics/{{ type }}.html %}
{% endif %}
{% endfor %}
{% endif %}

View File

@ -1,7 +1,9 @@
{% comment %}
Detect appearance language and return it through variable "lang"
{% endcomment %}
{% if site.data.locales[site.lang] %}
{% if site.data.locales[page.lang] %}
{% assign lang = page.lang %}
{% elsif site.data.locales[site.lang] %}
{% assign lang = site.lang %}
{% else %}
{% assign lang = 'en' %}

37
_includes/media-url.html Normal file
View File

@ -0,0 +1,37 @@
{%- comment -%}
Generate media resource final URL based on `site.cdn`, `page.media_subpath`
Arguments:
src - required, basic media resources path
subpath - optional, relative path of media resources
absolute - optional, boolean, if true, generate absolute URL
Return:
media resources URL
{%- endcomment -%}
{% assign url = include.src %}
{%- if url -%}
{% unless url contains ':' %}
{%- comment -%} Add media resources subpath prefix {%- endcomment -%}
{% assign url = include.subpath | default: '' | append: '/' | append: url %}
{%- comment -%} Prepend CND URL {%- endcomment -%}
{% if site.cdn %}
{% assign url = site.cdn | append: '/' | append: url %}
{% endif %}
{% assign url = url | replace: '///', '/' | replace: '//', '/' | replace: ':/', '://' %}
{% unless url contains '://' %}
{% if include.absolute %}
{% assign url = site.url | append: site.baseurl | append: url %}
{% else %}
{% assign url = site.baseurl | append: url %}
{% endif %}
{% endunless %}
{% endunless %}
{%- endif -%}
{{- url -}}

View File

@ -0,0 +1,18 @@
<!-- Display GoatCounter pageviews -->
<script>
let pv = document.getElementById('pageviews');
if (pv !== null) {
const uri = location.pathname.replace(/\/$/, '');
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
fetch(url)
.then((response) => response.json())
.then((data) => {
pv.innerText = new Intl.NumberFormat().format(data.count);
})
.catch((error) => {
pv.innerText = '1';
});
}
</script>

View File

@ -0,0 +1,16 @@
{%- comment -%}
Get post description or generate it from the post content.
{%- endcomment -%}
{%- assign max_length = include.max_length | default: 200 -%}
{%- capture description -%}
{%- if post.description -%}
{{- post.description -}}
{%- else -%}
{%- include no-linenos.html content=post.content -%}
{{- content | markdownify | strip_html -}}
{%- endif -%}
{%- endcapture -%}
{{- description | strip | truncate: max_length | escape -}}

View File

@ -97,7 +97,7 @@
{% assign _lazyload = true %}
{%- capture _img_url -%}
{% include img-url.html src=_src img_path=page.img_path %}
{% include media-url.html src=_src subpath=page.media_subpath %}
{%- endcapture -%}
{% assign _path_prefix = _img_url | remove: _src %}

View File

@ -81,10 +81,7 @@
{% include datetime.html date=post.date lang=include.lang %}
<h4 class="pt-0 my-2">{{ post.title }}</h4>
<div class="text-muted">
<p>
{% include no-linenos.html content=post.content %}
{{ content | markdownify | strip_html | truncate: 200 | escape }}
</p>
<p>{% include post-description.html %}</p>
</div>
</div>
</a>

View File

@ -5,7 +5,7 @@
<a href="{{ '/' | relative_url }}" id="avatar" class="rounded-circle">
{%- if site.avatar != empty and site.avatar -%}
{%- capture avatar_url -%}
{% include img-url.html src=site.avatar %}
{% include media-url.html src=site.avatar %}
{%- endcapture -%}
<img src="{{- avatar_url -}}" width="112" height="112" alt="avatar" onerror="this.style.display='none'">
{%- endif -%}

View File

@ -13,7 +13,7 @@ layout: compress
{% endif %}
<!-- `site.alt_lang` can specify a language different from the UI -->
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
<html lang="{{ page.lang | default: site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}
<body>
@ -76,12 +76,12 @@ layout: compress
<!-- JavaScripts -->
{% include js-selector.html %}
{% include js-selector.html lang=lang %}
{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}
{% include_cached search-loader.html %}
{% include_cached search-loader.html lang=lang %}
</body>
</html>

View File

@ -49,7 +49,7 @@ refactor: true
{% if post.image %}
{% assign src = post.image.path | default: post.image %}
{% unless src contains '//' %}
{% assign src = post.img_path | append: '/' | append: src | replace: '//', '/' %}
{% assign src = post.media_subpath | append: '/' | append: src | replace: '//', '/' %}
{% endunless %}
{% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %}
@ -72,10 +72,7 @@ refactor: true
<h1 class="card-title my-2 mt-md-0">{{ post.title }}</h1>
<div class="card-text content mt-0 mb-3">
<p>
{% include no-linenos.html content=post.content %}
{{ content | markdownify | strip_html | truncate: 200 | escape }}
</p>
<p>{% include post-description.html %}</p>
</div>
<div class="post-meta flex-grow-1 d-flex align-items-end">

View File

@ -14,6 +14,9 @@ tail_includes:
<article class="px-1">
<header>
<h1 data-toc-skip>{{ page.title }}</h1>
{% if page.description %}
<p class="post-desc fw-light mb-4">{{ page.description }}</p>
{% endif %}
<div class="post-meta text-muted">
<!-- published date -->
@ -74,12 +77,22 @@ tail_includes:
</em>
</span>
<!-- read time -->
{% include read-time.html content=content prompt=true lang=lang %}
<div>
<!-- pageviews -->
{% if site.pageviews.provider and site.analytics[site.pageviews.provider].id %}
<span>
<em id="pageviews">
<i class="fas fa-spinner fa-spin small"></i>
</em>
{{ site.data.locales[lang].post.pageview_measure }}
</span>
{% endif %}
<!-- read time -->
{% include read-time.html content=content prompt=true lang=lang %}
</div>
</div>
<!-- .d-flex -->
</div>
<!-- .post-meta -->
</header>
<div class="content">

View File

@ -1,5 +1,6 @@
---
title: Text and Typography
description: Examples of text, typography, math equations, diagrams, flowcharts, pictures, videos, and more.
author: cotes
date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo]
@ -13,10 +14,10 @@ image:
alt: Responsive rendering of Chirpy theme on multiple devices.
---
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
## Headings
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->
# H1 - heading
{: .mt-4 .mb-0 }
@ -28,6 +29,7 @@ This post is to show Markdown syntax rendering on [**Chirpy**](https://github.co
#### H4 - heading
{: data-toc-skip='' .mt-4 }
<!-- markdownlint-restore -->
## Paragraph
@ -44,15 +46,15 @@ Quisque egestas convallis ipsum, ut sollicitudin risus tincidunt a. Maecenas int
### Unordered list
- Chapter
+ Section
* Paragraph
- Section
- Paragraph
### ToDo list
- [ ] Job
+ [x] Step 1
+ [x] Step 2
+ [ ] Step 3
- [x] Step 1
- [x] Step 2
- [ ] Step 3
### Description list
@ -68,6 +70,8 @@ Moon
## Prompts
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->
> An example showing the `tip` type prompt.
{: .prompt-tip }
@ -79,14 +83,15 @@ Moon
> An example showing the `danger` type prompt.
{: .prompt-danger }
<!-- markdownlint-restore -->
## Tables
| Company | Contact | Country |
|:-----------------------------|:-----------------|--------:|
| :--------------------------- | :--------------- | ------: |
| Alfreds Futterkiste | Maria Anders | Germany |
| Island Trading | Helen Bennett | UK |
| Magazzini Alimentari Riuniti | Giovanni Rovelli | Italy |
| Island Trading | Helen Bennett | UK |
| Magazzini Alimentari Riuniti | Giovanni Rovelli | Italy |
## Links
@ -108,7 +113,7 @@ Here is the `/path/to/the/file.extend`{: .filepath}.
### Common
```
```text
This is a common code snippet, without syntax highlight and line number.
```

View File

@ -58,7 +58,6 @@ Adding author information in `_data/authors.yml` (If your website doesn't have t
```
{: file="_data/authors.yml" }
And then use `author` to specify a single entry or `authors` to specify multiple entries:
```yaml
@ -74,6 +73,18 @@ 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 }
### Post Description
By default, the first words of the post are used to display on the home page for a list of posts, in the _Further Reading_ section, and in the XML of the RSS feed. If you don't want to display the auto-generated description for the post, you can customize it using the `description` field in the _Front Matter_ as follows:
```yaml
---
description: Short summary of the post.
---
```
Additionally, the `description` text will also be displayed under the post title on the post's page.
## Table of Contents
By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to `_config.yml`{: .filepath} and set the value of variable `toc` to `false`. If you want to turn off TOC for a specific post, add the following to the post's [Front Matter](https://jekyllrb.com/docs/front-matter/):
@ -236,14 +247,14 @@ The screenshots of the program window can be considered to show the shadow effec
### CDN URL
If you host the images on the CDN, you can save the time of repeatedly writing the CDN URL by assigning the variable `img_cdn` of `_config.yml`{: .filepath} file:
If you host the media resources on the CDN, you can save the time of repeatedly writing the CDN URL by assigning the variable `cdn` of `_config.yml`{: .filepath} file:
```yaml
img_cdn: https://cdn.com
cdn: https://cdn.com
```
{: file='_config.yml' .nolineno}
Once `img_cdn` is assigned, the CDN URL will be added to the path of all images (images of site avatar and posts) starting with `/`.
Once `cdn` is assigned, the CDN URL will be added to the path of all media resources (site avatar, posts' images, audio and video files) starting with `/`.
For instance, when using images:
@ -259,13 +270,13 @@ The parsing result will automatically add the CDN prefix `https://cdn.com` befor
```
{: .nolineno }
### Image Path
### Media Subpath
When a post contains many images, it will be a time-consuming task to repeatedly define the path of the images. To solve this, we can define this path in the YAML block of the post:
When a post contains many images, it will be a time-consuming task to repeatedly define the path of the media resources. To solve this, we can define this path in the YAML block of the post:
```yml
---
img_path: /img/path/
media_subpath: /img/path/
---
```
@ -297,7 +308,7 @@ image:
---
```
Note that 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.
Note that the [`media_subpath`](#media-subpath) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
For simple use, you can also just use `image` to define the path.
@ -320,7 +331,6 @@ image:
> You can observe LQIP in the preview image of post [_Text and Typography_](/posts/text-and-typography/).
For normal images:
```markdown
@ -427,6 +437,8 @@ Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the pos
## Videos
### Video Sharing Platform
You can embed a video with the following syntax:
```liquid
@ -443,6 +455,76 @@ The following table shows how to get the two parameters we need in a given video
| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` |
| [https://www.**bilibili**.com/video/**BV1Q44y1B7Wf**](https://www.bilibili.com/video/BV1Q44y1B7Wf) | `bilibili` | `BV1Q44y1B7Wf` |
### Video File
If you want to embed a video file directly, use the following syntax:
```liquid
{% include embed/video.html src='{URL}' %}
```
Where `URL` is an URL to a video file e.g. `/assets/img/sample/video.mp4`.
You can also specify additional attributes for the embedded video file. Here is a full list of attributes allowed.
- `poster='/path/to/poster.png'` - poster image for a video that is shown while video is downloading
- `title='Text'` - title for a video that appears below the video and looks same as for images
- `autoplay=true` - video automatically begins to play back as soon as it can
- `loop=true` - automatically seek back to the start upon reaching the end of the video
- `muted=true` - audio will be initially silenced
- `types` - specify the extensions of additional video formats separated by `|`. Ensure these files exist in the same directory as your primary video file.
Consider an example utilizing all of the above:
```liquid
{%
include embed/video.html
src='/path/to/video/video.mp4'
types='ogg|mov'
poster='poster.png'
title='Demo video'
autoplay=true
loop=true
muted=true
%}
```
> It's not recommended to host video files in `assets` folder as they cannot be cached by PWA and may cause issues.
> Instead, use CDN to host video files. Alternatively, use a separate folder that is excluded from PWA (see `pwa.deny_paths` setting in `_config.yml`).
{: .prompt-warning }
## Audios
### Audio File
If you want to embed an audio file directly, use the following syntax:
```liquid
{% include embed/audio.html src='{URL}' %}
```
Where `URL` is an URL to an audio file e.g. `/assets/img/sample/audio.mp3`.
You can also specify additional attributes for the embedded audio file. Here is a full list of attributes allowed.
- `title='Text'` - title for an audio that appears below the audio and looks same as for images
- `types` - specify the extensions of additional audio formats separated by `|`. Ensure these files exist in the same directory as your primary audio file.
Consider an example utilizing all of the above:
```liquid
{%
include embed/audio.html
src='/path/to/audio/audio.mp3'
types='ogg|wav|aac'
title='Demo audio'
%}
```
> It's not recommended to host audio files in `assets` folder as they cannot be cached by PWA and may cause issues.
> Instead, use CDN to host audio files. Alternatively, use a separate folder that is excluded from PWA (see `pwa.deny_paths` setting in `_config.yml`).
{: .prompt-warning }
## Learn More
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).

View File

@ -1,11 +1,14 @@
---
title: Getting Started
description: >-
Get started with Chirpy basics in this comprehensive overview.
You will learn how to install, configure, and use your first Chirpy-based website, as well as deploy it to a web server.
author: cotes
date: 2019-08-09 20:55:00 +0800
categories: [Blogging, Tutorial]
tags: [getting started]
pin: true
img_path: '/posts/20180809'
media_subpath: '/posts/20180809'
---
## Prerequisites

View File

@ -30,6 +30,7 @@ The following table will help you understand the changes to the favicon files:
| `*.PNG` | ✓ | ✗ |
| `*.ICO` | ✓ | ✗ |
<!-- markdownlint-disable-next-line -->
> ✓ means keep, ✗ means delete.
{: .prompt-info }

View File

@ -129,6 +129,11 @@ kbd {
box-shadow: inset 0 -2px 0 var(--kbd-wrap-color);
}
hr {
border-color: var(--main-border-color);
opacity: 1;
}
footer {
background-color: var(--main-bg);
height: $footer-height;
@ -364,7 +369,6 @@ main {
h1 {
margin-top: 2rem;
margin-bottom: 1.5rem;
}
p {
@ -550,17 +554,32 @@ main {
width: 100%;
height: 100%;
margin-bottom: 1rem;
aspect-ratio: 16 / 9;
@extend %rounded;
&.youtube,
&.bilibili {
aspect-ratio: 16 / 9;
}
&.twitch {
aspect-ratio: 310 / 189;
}
&.file {
display: block;
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
margin: auto;
margin-bottom: 0;
}
@extend %img-caption;
}
.embed-audio {
width: 100%;
display: block;
@extend %img-caption;
}
/* --- buttons --- */

View File

@ -104,10 +104,6 @@
display: none;
}
hr {
border-color: var(--main-border-color);
}
/* categories */
.categories.card,
.list-group-item {

View File

@ -14,20 +14,33 @@
padding-right: $pr;
}
h1 + .post-meta {
> span + span::before {
@include dot;
header {
.post-desc {
@extend %heading;
font-size: 1.125rem;
line-height: 1.6;
}
em,
time {
@extend %text-highlight;
}
em {
a {
color: inherit;
.post-meta {
span + span::before {
@include dot;
}
em,
time {
@extend %text-highlight;
}
em {
a {
color: inherit;
}
}
}
h1 + .post-meta {
margin-top: 1.5rem;
}
}

View File

@ -45,14 +45,7 @@ permalink: /feed.xml
{% endfor %}
{% endif %}
{% if post.summary %}
<summary>{{ post.summary | strip }}</summary>
{% else %}
<summary>
{% include no-linenos.html content=post.content %}
{{ content | strip_html | truncate: 400 }}
</summary>
{% endif %}
<summary>{% include post-description.html max_length=400 %}</summary>
</entry>
{% endfor %}

View File

@ -24,8 +24,8 @@ const swconf = {
{%- comment -%} The request url with below domain will be cached. {%- endcomment -%}
allowHosts: [
{% if site.img_cdn and site.img_cdn contains '//' %}
'{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
{% if site.cdn and site.cdn contains '//' %}
'{{ site.cdn | split: '//' | last | split: '/' | first }}',
{% endif %}
{%- unless site.assets.self_host.enabled -%}

View File

@ -2,6 +2,12 @@
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.
## [6.5.5](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.5.4...v6.5.5) (2024-03-23)
### Bug Fixes
* **post:** correct the image URLs ([#1627](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1627)) ([2d649aa](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2d649aae0e40a24db1ab0d46fa474294e96cb135))
## [6.5.4](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.5.3...v6.5.4) (2024-03-22)
### Bug Fixes
@ -11,6 +17,8 @@ All notable changes to this project will be documented in this file. See [standa
## [6.5.3](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.5.2...v6.5.3) (2024-03-07)
* replace `polyfill.io` with `cdnjs` hosted link ([#1598](https://github.com/cotes2020/jekyll-theme-chirpy/pull/1598)) ([75a3d73](https://github.com/cotes2020/jekyll-theme-chirpy/commit/75a3d7399b257256a09d602cbe01062fe1cdf68d))
## [6.5.2](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.5.1...v6.5.2) (2024-02-29)
### Bug Fixes

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "jekyll-theme-chirpy",
"version": "6.5.4",
"version": "6.5.5",
"description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.",
"repository": {
"type": "git",
@ -21,18 +21,18 @@
"fixlint": "npm run test -- --fix"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.9",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@babel/core": "^7.24.3",
"@babel/plugin-transform-class-properties": "^7.24.1",
"@babel/preset-env": "^7.24.3",
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.4",
"husky": "^9.0.11",
"rimraf": "^5.0.5",
"rollup": "^4.10.0",
"rollup-plugin-license": "^3.2.0",
"stylelint": "^16.2.1",
"rollup": "^4.13.2",
"rollup-plugin-license": "^3.3.1",
"stylelint": "^16.3.1",
"stylelint-config-standard-scss": "^13.0.0"
},
"prettier": {

View File

@ -23,7 +23,7 @@ function build(filename) {
babel({
babelHelpers: 'bundled',
presets: ['@babel/env'],
plugins: ['@babel/plugin-proposal-class-properties']
plugins: ['@babel/plugin-transform-class-properties']
}),
license({
banner: {

View File

@ -93,7 +93,7 @@ init_files() {
mv ./${ACTIONS_WORKFLOW}.hook .github/workflows/${ACTIONS_WORKFLOW}
## Cleanup image settings in site config
_sedi "s/^img_cdn:.*/img_cdn:/;s/^avatar:.*/avatar:/" _config.yml
_sedi "s/^cdn:.*/cdn:/;s/^avatar:.*/avatar:/" _config.yml
fi
# remove the other files

View File

@ -156,7 +156,7 @@ build_gem() {
git checkout "$PROD_BRANCH"
# Remove unnecessary theme settings
sed -i "s/^img_cdn:.*/img_cdn:/;s/^avatar:.*/avatar:/" _config.yml
sed -i "s/^cdn:.*/cdn:/;s/^avatar:.*/avatar:/" _config.yml
rm -f ./*.gem
npm run build