Compare commits

..

2 Commits

Author SHA1 Message Date
Aliberk Sandıkçı 74abd40483 update configurations 2024-04-13 02:00:37 +03:00
Aliberk Sandıkçı c1c46e6db9 chore: initialize the environment 2024-04-13 01:43:02 +03:00
69 changed files with 151 additions and 1687 deletions

View File

@ -1,26 +0,0 @@
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: dropdown
attributes:
label: What is the topic?
options:
- Sharing tips and tricks
- Just chatting
validations:
required: true
- type: textarea
attributes:
label: Description
description: Please describe in detail what you want to share.
validations:
required: true

View File

@ -1,40 +0,0 @@
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: dropdown
id: download
attributes:
label: How did you create the site?
options:
- Generated from `chirpy-starter`
- Built from `jekyll-theme-chirpy`
validations:
required: true
- type: textarea
attributes:
label: Description
description: Please describe your need in detail.
validations:
required: true
- type: textarea
attributes:
label: Operations you have already tried
description: Describe the effort you went through.
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Or logs? Anything that will give us more context about the issue you are encountering!

2
.github/FUNDING.yml vendored
View File

@ -1,2 +0,0 @@
ko_fi: coteschung
custom: https://sponsor.cotes.page

View File

@ -1,64 +0,0 @@
name: Bug Report
description: Create a report to help us improve
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: dropdown
id: download
attributes:
label: How did you create the site?
options:
- Generated from `chirpy-starter`
- Built from `jekyll-theme-chirpy`
validations:
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Environment
value: |
- Ruby: <!-- run `ruby -v` -->
- Jekyll: <!-- run `bundle exec jekyll -v` -->
- Chirpy: <!-- run `bundle info jekyll-theme-chirpy` -->
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Or logs? Anything that will give us more context about the issue you are encountering!

View File

@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Ask the community for help
url: https://github.com/cotes2020/jekyll-theme-chirpy/discussions
about: Please ask and answer questions here.

View File

@ -1,38 +0,0 @@
name: Feature Request
description: Suggest an idea for this project
labels:
- enhancement
body:
- type: checkboxes
attributes:
label: Checklist
description: Following the guidelines can make you more likely to get responses.
options:
- label: >-
I have read and accepted the
[contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md).
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe
description: A clear and concise description of what the problem is.
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.

View File

@ -1,17 +0,0 @@
## Type of change
<!-- Please select the desired item checkbox and change it from `[ ]` to `[x]` and then delete the irrelevant options. -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Improvement (refactoring and improving code)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Description
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
-->
## Additional context
<!-- e.g. Fixes #(issue) -->

View File

@ -1,2 +0,0 @@
paths-ignore:
- "assets/js"

View File

@ -1,26 +0,0 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
versioning-strategy: increase
groups:
bundler:
dependency-type: "production"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/"
versioning-strategy: increase
groups:
npm:
dependency-type: "development"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
groups:
gh-actions:
update-types:
- "major"
schedule:
interval: "weekly"

View File

@ -1,17 +0,0 @@
name: CD
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- docs
jobs:
launch:
runs-on: ubuntu-latest
steps:
- run: |
curl -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \
-d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}'

View File

@ -1,45 +0,0 @@
name: "CI"
on:
push:
branches-ignore:
- "production"
- "docs"
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- ".gitignore"
- "docs/**"
- "README.md"
- "LICENSE"
pull_request:
paths:
- "**"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["3.0", "3.1", "3.2"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Setup Node
uses: actions/setup-node@v4
- name: Build Assets
run: npm i && npm run build
- name: Test Site
run: bash tools/test

View File

@ -1,43 +0,0 @@
name: "CodeQL"
on:
push:
paths: ["_javascript/**/*.js"]
pull_request:
paths: ["_javascript/**/*.js"]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["javascript"]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: "${{ matrix.language }}"
config-file: .github/codeql/codeql-config.yml
# 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@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"

View File

@ -1,11 +0,0 @@
name: Lint Commit Messages
on: pull_request
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6

View File

@ -1,32 +0,0 @@
name: "Close stale issues and PRs"
on:
schedule:
- cron: "0 0 * * *" # every day at 00:00 UTC
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@v9
with:
# 60 days before marking issues/PRs stale
days-before-close: -1 # does not close automatically
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 }}

View File

@ -1,25 +0,0 @@
name: "Style Lint"
on:
push:
branches-ignore:
- "production"
- "docs"
paths:
- "_sass/**/*.scss"
pull_request:
paths:
- "_sass/**/*.scss"
jobs:
stylelint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- run: npm i
- run: npm test

1
.gitignore vendored
View File

@ -18,4 +18,3 @@ package-lock.json
.idea
# Misc
assets/js/dist

View File

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

View File

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

View File

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

View File

@ -1,7 +1,5 @@
<!-- 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.
@ -36,7 +34,7 @@
- Built-in Search
- Atom Feeds
- PWA
- Web Analytics
- Google Analytics / GoatCounter
- SEO & Performance Optimization
## Documentation

View File

@ -9,21 +9,21 @@ theme: jekyll-theme-chirpy
lang: en
# Change to your timezone https://kevinnovak.github.io/Time-Zone-Picker
timezone: Asia/Shanghai
timezone: Europe/Istanbul
# jekyll-seo-tag settings https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# ↓ --------------------------
title: Chirpy # the main title
title: Aliberk Sandıı # the main title
tagline: A text-focused Jekyll theme # it will display as the sub-title
tagline: Personal Website & Blog # it will display as the sub-title
description: >- # used by seo meta and the atom feed
A minimal, responsive and feature-rich Jekyll theme for technical writing.
Personal Website & Blog of Aliberk Sandıı
# Fill in the protocol & hostname for your site.
# e.g. 'https://username.github.io', note that it does not end with a '/'.
url: ""
url: "https://asandikci.com"
github:
username: github_username # change to your github username
@ -34,8 +34,8 @@ twitter:
social:
# Change to your full name.
# It will be displayed as the default author of the posts and the copyright owner in the Footer
name: your_full_name
email: example@domain.com # change to your email address
name: Aliberk Sandıı
email: contact@aliberksandikci.com.tr # change to your email address
links:
# The first element serves as the copyright owner's link
- https://twitter.com/username # change to your twitter homepage
@ -44,35 +44,9 @@ social:
# - https://www.facebook.com/username
# - https://www.linkedin.com/in/username
# 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
# 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
# Pageviews settings
pageviews:
provider: # now only supports 'goatcounter'
# Prefer color scheme setting.
#
# Note: Keep empty will follow the system prefer color by default,
@ -86,15 +60,9 @@ pageviews:
#
theme_mode: # [light | dark]
# The CDN endpoint for media resources.
# Notice that once it is assigned, the CDN url
# will be added to all media resources (site avatar, posts' images, audio and video files) paths starting with '/'
#
# e.g. 'https://cdn.com'
cdn: "https://chirpy-img.netlify.app"
# the avatar on sidebar, support local or CORS resources
avatar: "/commons/avatar.jpg"
avatar: https://secure.gravatar.com/avatar/9e6d3b45325892e77d8d4e3758ae9977?d=identicon
# 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.
@ -104,9 +72,8 @@ social_preview_image: # string, local or CORS resources
toc: true
comments:
# Global switch for the post comment system. Keeping it empty means disabled.
provider: # [disqus | utterances | giscus]
# The provider options are as follows:
active: # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable
# The active 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/
@ -120,7 +87,6 @@ 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`
@ -146,7 +112,7 @@ pwa:
paginate: 10
# The base URL of your site
baseurl: ""
baseurl:
# ------------ The following options are not recommended to be modified ------------------

View File

@ -1,18 +0,0 @@
- 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:wght@300;400&family=Source+Sans+Pro:wght@400;600;700;900&display=swap
webfonts: https://fonts.googleapis.com/css2?family=Lato&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: "https://service.weibo.com/share/share.php?title=TITLE&url=URL"
# link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL"
#
# - type: Mastodon
# icon: "fa-brands fa-mastodon"

View File

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

View File

@ -1,13 +0,0 @@
<!-- 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

@ -1,14 +0,0 @@
<!-- 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

@ -1,6 +0,0 @@
<!-- 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.provider %}
{% capture path %}comments/{{ site.comments.provider }}.html{% endcapture %}
<!-- The comments switcher -->
{% if page.comments and site.comments.active %}
{% capture path %}comments/{{ site.comments.active }}.html{% endcapture %}
{% include {{ path }} %}
{% endif %}

View File

@ -25,7 +25,6 @@
'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

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

View File

@ -1,59 +0,0 @@
{% 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"
class="embed-video youtube"
loading="lazy"
src="https://www.youtube.com/embed/{{ include.id }}"
title="YouTube video player"

View File

@ -34,14 +34,7 @@
{%- endcapture -%}
{%- capture _theme -%}
<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>
<a 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

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

View File

@ -0,0 +1,14 @@
<!--
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 media-url.html src=src subpath=page.media_subpath absolute=true %}
{% include img-url.html src=src img_path=page.img_path absolute=true %}
{%- endcapture -%}
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
@ -31,7 +31,7 @@
{% elsif site.social_preview_image %}
{%- capture img_url -%}
{% include media-url.html src=site.social_preview_image absolute=true %}
{% include img-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.analytics.google.id != empty and site.analytics.google.id %}
{% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.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,25 +1,25 @@
{%- comment -%}
Generate media resource final URL based on `site.cdn`, `page.media_subpath`
Generate image final URL based on `site.img_cdn`, `page.img_path`
Arguments:
src - required, basic media resources path
subpath - optional, relative path of media resources
src - required, basic image path
img_path - optional, relative path of image
absolute - optional, boolean, if true, generate absolute URL
Return:
media resources URL
image 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 -%} Add page image path prefix {%- endcomment -%}
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
{%- comment -%} Prepend CND URL {%- endcomment -%}
{% if site.cdn %}
{% assign url = site.cdn | append: '/' | append: url %}
{% if site.img_cdn %}
{% assign url = site.img_cdn | append: '/' | append: url %}
{% endif %}
{% assign url = url | replace: '///', '/' | replace: '//', '/' | replace: ':/', '://' %}

View File

@ -33,7 +33,7 @@
or page.layout == 'category'
or page.layout == 'tag'
%}
{% assign locale = include.lang | split: '-' | first %}
{% assign locale = site.lang | split: '-' | first %}
{% assign urls = urls
| append: ','
@ -95,32 +95,19 @@
<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 %}
<!-- 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 %}
<!-- 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 %}
{% endif %}

View File

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

View File

@ -1,18 +0,0 @@
<!-- 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

@ -1,16 +0,0 @@
{%- 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 media-url.html src=_src subpath=page.media_subpath %}
{% include img-url.html src=_src img_path=page.img_path %}
{%- endcapture -%}
{% assign _path_prefix = _img_url | remove: _src %}

View File

@ -81,7 +81,10 @@
{% include datetime.html date=post.date lang=include.lang %}
<h4 class="pt-0 my-2">{{ post.title }}</h4>
<div class="text-muted">
<p>{% include post-description.html %}</p>
<p>
{% include no-linenos.html content=post.content %}
{{ content | markdownify | strip_html | truncate: 200 | escape }}
</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 media-url.html src=site.avatar %}
{% include img-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="{{ page.lang | default: site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}
<body>
@ -76,12 +76,12 @@ layout: compress
<!-- JavaScripts -->
{% include js-selector.html lang=lang %}
{% include js-selector.html %}
{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}
{% include_cached search-loader.html lang=lang %}
{% include_cached search-loader.html %}
</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.media_subpath | append: '/' | append: src | replace: '//', '/' %}
{% assign src = post.img_path | append: '/' | append: src | replace: '//', '/' %}
{% endunless %}
{% assign alt = post.image.alt | xml_escape | default: 'Preview Image' %}
@ -72,7 +72,10 @@ 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 post-description.html %}</p>
<p>
{% include no-linenos.html content=post.content %}
{{ content | markdownify | strip_html | truncate: 200 | escape }}
</p>
</div>
<div class="post-meta flex-grow-1 d-flex align-items-end">

View File

@ -14,9 +14,6 @@ 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 -->
@ -77,22 +74,12 @@ tail_includes:
</em>
</span>
<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>
<!-- read time -->
{% include read-time.html content=content prompt=true lang=lang %}
</div>
<!-- .d-flex -->
</div>
<!-- .post-meta -->
</header>
<div class="content">

View File

@ -1,200 +0,0 @@
---
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]
tags: [typography]
pin: true
math: true
mermaid: true
image:
path: /commons/devices-mockup.png
lqip: data:image/webp;base64,UklGRpoAAABXRUJQVlA4WAoAAAAQAAAADwAABwAAQUxQSDIAAAARL0AmbZurmr57yyIiqE8oiG0bejIYEQTgqiDA9vqnsUSI6H+oAERp2HZ65qP/VIAWAFZQOCBCAAAA8AEAnQEqEAAIAAVAfCWkAALp8sF8rgRgAP7o9FDvMCkMde9PK7euH5M1m6VWoDXf2FkP3BqV0ZYbO6NA/VFIAAAA
alt: Responsive rendering of Chirpy theme on multiple devices.
---
## Headings
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->
# H1 - heading
{: .mt-4 .mb-0 }
## H2 - heading
{: data-toc-skip='' .mt-4 .mb-0 }
### H3 - heading
{: data-toc-skip='' .mt-4 .mb-0 }
#### H4 - heading
{: data-toc-skip='' .mt-4 }
<!-- markdownlint-restore -->
## Paragraph
Quisque egestas convallis ipsum, ut sollicitudin risus tincidunt a. Maecenas interdum malesuada egestas. Duis consectetur porta risus, sit amet vulputate urna facilisis ac. Phasellus semper dui non purus ultrices sodales. Aliquam ante lorem, ornare a feugiat ac, finibus nec mauris. Vivamus ut tristique nisi. Sed vel leo vulputate, efficitur risus non, posuere mi. Nullam tincidunt bibendum rutrum. Proin commodo ornare sapien. Vivamus interdum diam sed sapien blandit, sit amet aliquam risus mattis. Nullam arcu turpis, mollis quis laoreet at, placerat id nibh. Suspendisse venenatis eros eros.
## Lists
### Ordered list
1. Firstly
2. Secondly
3. Thirdly
### Unordered list
- Chapter
- Section
- Paragraph
### ToDo list
- [ ] Job
- [x] Step 1
- [x] Step 2
- [ ] Step 3
### Description list
Sun
: the star around which the earth orbits
Moon
: the natural satellite of the earth, visible by reflected light from the sun
## Block Quote
> This line shows the _block quote_.
## Prompts
<!-- markdownlint-capture -->
<!-- markdownlint-disable -->
> An example showing the `tip` type prompt.
{: .prompt-tip }
> An example showing the `info` type prompt.
{: .prompt-info }
> An example showing the `warning` type prompt.
{: .prompt-warning }
> 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 |
## Links
<http://127.0.0.1:4000>
## Footnote
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].
## Inline code
This is an example of `Inline Code`.
## Filepath
Here is the `/path/to/the/file.extend`{: .filepath}.
## Code blocks
### Common
```text
This is a common code snippet, without syntax highlight and line number.
```
### Specific Language
```bash
if [ $? -ne 0 ]; then
echo "The command was not successful.";
#do the needful / exit
fi;
```
### Specific filename
```sass
@import
"colors/light-typography",
"colors/dark-typography";
```
{: file='_sass/jekyll-theme-chirpy.scss'}
## Mathematics
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
$$
\begin{equation}
\sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6}
\label{eq:series}
\end{equation}
$$
We can reference the equation as \eqref{eq:series}.
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
## Mermaid SVG
```mermaid
gantt
title Adding GANTT diagram functionality to mermaid
apple :a, 2017-07-20, 1w
banana :crit, b, 2017-07-23, 1d
cherry :active, c, after b a, 1d
```
## Images
### Default (with caption)
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" }
_Full screen width and center alignment_
### Left aligned
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" .w-75 .normal}
### Float to left
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" .w-50 .left}
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.
### Float to right
![Desktop View](/posts/20190808/mockup.png){: width="972" height="589" .w-50 .right}
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.
### Dark/Light mode & Shadow
The image below will toggle dark/light mode based on theme preference, notice it has shadows.
![light mode only](/posts/20190808/devtools-light.png){: .light .w-75 .shadow .rounded-10 w='1212' h='668' }
![dark mode only](/posts/20190808/devtools-dark.png){: .dark .w-75 .shadow .rounded-10 w='1212' h='668' }
## Video
{% include embed/youtube.html id='Balreaj8Yqs' %}
## Reverse Footnote
[^footnote]: The footnote source
[^fn-nth-2]: The 2nd footnote source

View File

@ -1,530 +0,0 @@
---
title: Writing a New Post
author: cotes
date: 2019-08-08 14:10:00 +0800
categories: [Blogging, Tutorial]
tags: [writing]
render_with_liquid: false
---
This tutorial will guide you how to write a post in the _Chirpy_ template, and it's worth reading even if you've used Jekyll before, as many features require specific variables to be set.
## Naming and Path
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION`{: .filepath} and put it in the `_posts`{: .filepath} of the root directory. Please note that the `EXTENSION`{: .filepath} must be one of `md`{: .filepath} and `markdown`{: .filepath}. If you want to save time of creating files, please consider using the plugin [`Jekyll-Compose`](https://github.com/jekyll/jekyll-compose) to accomplish this.
## Front Matter
Basically, you need to fill the [Front Matter](https://jekyllrb.com/docs/front-matter/) as below at the top of the post:
```yaml
---
title: TITLE
date: YYYY-MM-DD HH:MM:SS +/-TTTT
categories: [TOP_CATEGORIE, SUB_CATEGORIE]
tags: [TAG] # TAG names should always be lowercase
---
```
> The posts' _layout_ has been set to `post` by default, so there is no need to add the variable _layout_ in the Front Matter block.
{: .prompt-tip }
### Timezone of Date
In order to accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`.
### Categories and Tags
The `categories` of each post are designed to contain up to two elements, and the number of elements in `tags` can be zero to infinity. For instance:
```yaml
---
categories: [Animal, Insect]
tags: [bee]
---
```
### Author Information
The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows:
Adding author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one).
```yaml
<author_id>:
name: <full name>
twitter: <twitter_of_author>
url: <homepage_of_author>
```
{: file="_data/authors.yml" }
And then use `author` to specify a single entry or `authors` to specify multiple entries:
```yaml
---
author: <author_id> # for single entry
# or
authors: [<author1_id>, <author2_id>] # for multiple entries
---
```
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/):
```yaml
---
toc: false
---
```
## Comments
The global switch of comments is defined by variable `comments.active` in the file `_config.yml`{: .filepath}. After selecting a comment system for this variable, comments will be turned on for all posts.
If you want to close the comment for a specific post, add the following to the **Front Matter** of the post:
```yaml
---
comments: false
---
```
## Mathematics
For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by:
```yaml
---
math: true
---
```
After enabling the mathematical feature, you can add math equations with the following syntax:
- **Block math** should be added with `$$ math $$` with **mandatory** blank lines before and after `$$`
- **Inserting equation numbering** should be added with `$$\begin{equation} math \end{equation}$$`
- **Referencing equation numbering** should be done with `\label{eq:label_name}` in the equation block and `\eqref{eq:label_name}` inline with text (see example below)
- **Inline math** (in lines) should be added with `$$ math $$` without any blank line before or after `$$`
- **Inline math** (in lists) should be added with `\$$ math $$`
```markdown
<!-- Block math, keep all blank lines -->
$$
LaTeX_math_expression
$$
<!-- Equation numbering, keep all blank lines -->
$$
\begin{equation}
LaTeX_math_expression
\label{eq:label_name}
\end{equation}
$$
Can be referenced as \eqref{eq:label_name}.
<!-- Inline math in lines, NO blank lines -->
"Lorem ipsum dolor sit amet, $$ LaTeX_math_expression $$ consectetur adipiscing elit."
<!-- Inline math in lists, escape the first `$` -->
1. \$$ LaTeX_math_expression $$
2. \$$ LaTeX_math_expression $$
3. \$$ LaTeX_math_expression $$
```
## Mermaid
[**Mermaid**](https://github.com/mermaid-js/mermaid) is a great diagram generation tool. To enable it on your post, add the following to the YAML block:
```yaml
---
mermaid: true
---
```
Then you can use it like other markdown languages: surround the graph code with ```` ```mermaid ```` and ```` ``` ````.
## Images
### Caption
Add italics to the next line of an image, then it will become the caption and appear at the bottom of the image:
```markdown
![img-description](/path/to/image)
_Image Caption_
```
{: .nolineno}
### Size
In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image.
```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" }
```
{: .nolineno}
> For an SVG, you have to at least specify its _width_, otherwise it won't be rendered.
{: .prompt-info }
Starting from _Chirpy v5.0.0_, `height` and `width` support abbreviations (`height` → `h`, `width``w`). The following example has the same effect as the above:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: w="700" h="400" }
```
{: .nolineno}
### Position
By default, the image is centered, but you can specify the position by using one of the classes `normal`, `left`, and `right`.
> Once the position is specified, the image caption should not be added.
{: .prompt-warning }
- **Normal position**
Image will be left aligned in below sample:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .normal }
```
{: .nolineno}
- **Float to the left**
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .left }
```
{: .nolineno}
- **Float to the right**
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .right }
```
{: .nolineno}
### Dark/Light mode
You can make images follow theme preferences in dark/light mode. This requires you to prepare two images, one for dark mode and one for light mode, and then assign them a specific class (`dark` or `light`):
```markdown
![Light mode only](/path/to/light-mode.png){: .light }
![Dark mode only](/path/to/dark-mode.png){: .dark }
```
### Shadow
The screenshots of the program window can be considered to show the shadow effect:
```markdown
![Desktop View](/assets/img/sample/mockup.png){: .shadow }
```
{: .nolineno}
### CDN URL
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
cdn: https://cdn.com
```
{: file='_config.yml' .nolineno}
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:
```markdown
![The flower](/path/to/flower.png)
```
{: .nolineno}
The parsing result will automatically add the CDN prefix `https://cdn.com` before the image path:
```html
<img src="https://cdn.com/path/to/flower.png" alt="The flower" />
```
{: .nolineno }
### Media Subpath
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
---
media_subpath: /img/path/
---
```
And then, the image source of Markdown can write the file name directly:
```md
![The flower](flower.png)
```
{: .nolineno }
The output will be:
```html
<img src="/img/path/flower.png" alt="The flower" />
```
{: .nolineno }
### Preview Image
If you want to add an image at the top of the post, please provide an image with a resolution of `1200 x 630`. Please note that if the image aspect ratio does not meet `1.91 : 1`, the image will be scaled and cropped.
Knowing these prerequisites, you can start setting the image's attribute:
```yaml
---
image:
path: /path/to/image
alt: image alternative text
---
```
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.
```yml
---
image: /path/to/image
---
```
### LQIP
For preview images:
```yaml
---
image:
lqip: /path/to/lqip-file # or base64 URI
---
```
> You can observe LQIP in the preview image of post [_Text and Typography_](/posts/text-and-typography/).
For normal images:
```markdown
![Image description](/path/to/image){: lqip="/path/to/lqip-file" }
```
{: .nolineno }
## Pinned Posts
You can pin one or more posts to the top of the home page, and the fixed posts are sorted in reverse order according to their release date. Enable by:
```yaml
---
pin: true
---
```
## Prompts
There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They can be generated by adding the class `prompt-{type}` to the blockquote. For example, define a prompt of type `info` as follows:
```md
> Example line for prompt.
{: .prompt-info }
```
{: .nolineno }
## Syntax
### Inline Code
```md
`inline code part`
```
{: .nolineno }
### Filepath Hightlight
```md
`/path/to/a/file.extend`{: .filepath}
```
{: .nolineno }
### Code Block
Markdown symbols ```` ``` ```` can easily create a code block as follows:
````md
```
This is a plaintext code snippet.
```
````
#### Specifying Language
Using ```` ```{language} ```` you will get a code block with syntax highlight:
````markdown
```yaml
key: value
```
````
> The Jekyll tag `{% highlight %}` is not compatible with this theme.
{: .prompt-danger }
#### Line Number
By default, all languages except `plaintext`, `console`, and `terminal` will display line numbers. When you want to hide the line number of a code block, add the class `nolineno` to it:
````markdown
```shell
echo 'No more line numbers!'
```
{: .nolineno }
````
#### Specifying the Filename
You may have noticed that the code language will be displayed at the top of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this:
````markdown
```shell
# content
```
{: file="path/to/file" }
````
#### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:
````markdown
{% raw %}
```liquid
{% if product.title contains 'Pack' %}
This product's title contains the word Pack.
{% endif %}
```
{% endraw %}
````
Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
## Videos
### Video Sharing Platform
You can embed a video with the following syntax:
```liquid
{% include embed/{Platform}.html id='{ID}' %}
```
Where `Platform` is the lowercase of the platform name, and `ID` is the video ID.
The following table shows how to get the two parameters we need in a given video URL, and you can also know the currently supported video platforms.
| Video URL | Platform | ID |
| -------------------------------------------------------------------------------------------------- | ---------- | :------------- |
| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` |
| [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,138 +0,0 @@
---
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
media_subpath: '/posts/20180809'
---
## Prerequisites
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.
## Installation
### Creating a New Site
There are two ways to create a new repository for this theme:
- [**Using the Chirpy Starter**](#option-1-using-the-chirpy-starter) - Easy to upgrade, isolates irrelevant project files so you can focus on writing.
- [**GitHub Fork**](#option-2-github-fork) - Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended.
#### Option 1. Using the Chirpy Starter
Sign in to GitHub and browse to [**Chirpy Starter**][starter], click the button <kbd>Use this template</kbd> > <kbd>Create a new repository</kbd>, and name the new repository `USERNAME.github.io`, where `USERNAME` represents your GitHub username.
#### Option 2. GitHub Fork
Sign in to GitHub to [fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), and then rename it to `USERNAME.github.io` (`USERNAME` means your username).
Next, clone your site to local machine. In order to build JavaScript files later, we need to install [Node.js][nodejs], and then run the tool:
```console
$ bash tools/init
```
> If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command.
{: .prompt-info }
The above command will:
1. Check out the code to the [latest tag][latest-tag] (to ensure the stability of your site: as the code for the default branch is under development).
2. Remove non-essential sample files and take care of GitHub-related files.
3. Build JavaScript files and export to `assets/js/dist/`{: .filepath }, then make them tracked by Git.
4. Automatically create a new commit to save the changes above.
### Installing Dependencies
Before running local server for the first time, go to the root directory of your site and run:
```console
$ bundle
```
## Usage
### Configuration
Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options:
- `url`
- `avatar`
- `timezone`
- `lang`
### Social Contact Options
Social contact options are displayed at the bottom of the sidebar. You can turn on/off the specified contacts in file `_data/contact.yml`{: .filepath }.
### Customizing Stylesheet
If you need to customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of it.
Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main sass file `_sass/main.scss`{: .filepath} into the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign new value.
### Customing Static Assets
Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined by file `_data/origin/cors.yml`{: .filepath }, and you can replace some of them according to the network conditions in the region where your website is published.
Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme).
### Running Local Server
You may want to preview the site contents before publishing, so just run it by:
```console
$ bundle exec jekyll s
```
After a few seconds, the local service will be published at _<http://127.0.0.1:4000>_.
## Deployment
Before the deployment begins, check out the file `_config.yml`{: .filepath} and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starts with a slash, e.g, `/project-name`.
Now you can choose _ONE_ of the following methods to deploy your Jekyll site.
### Deploy by Using GitHub Actions
There are a few things to get ready for.
- If you're on the GitHub Free plan, keep your site repository public.
- If you have committed `Gemfile.lock`{: .filepath} to the repository, and your local machine is not running Linux, go to the root of your site and update the platform list of the lock-file:
```console
$ bundle lock --add-platform x86_64-linux
```
Next, configure the _Pages_ service.
1. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar. Then, in the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu.
![Build source](pages-source-light.png){: .light .border .normal w='375' h='140' }
![Build source](pages-source-dark.png){: .dark .normal w='375' h='140' }
2. Push any commits to GitHub to trigger the _Actions_ workflow. In the _Actions_ tab of your repository, you should see the workflow _Build and Deploy_ running. Once the build is complete and successful, the site will be deployed automatically.
At this point, you can go to the URL indicated by GitHub to access your site.
### Manually Build and Deploy
On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server.
Go to the root of the source project, and build your site as follows:
```console
$ JEKYLL_ENV=production bundle exec jekyll b
```
Unless you specified the output path, the generated site files will be placed in folder `_site`{: .filepath} of the project's root directory. Now you should upload those files to the target server.
[nodejs]: https://nodejs.org/
[starter]: https://github.com/cotes2020/chirpy-starter
[pages-workflow-src]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow
[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags

View File

@ -1,37 +0,0 @@
---
title: Customize the Favicon
author: cotes
date: 2019-08-11 00:34:00 +0800
categories: [Blogging, Tutorial]
tags: [favicon]
---
The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`{: .filepath}. You may want to replace them with your own. The following sections will guide you to create and replace the default favicons.
## Generate the favicon
Prepare a square image (PNG, JPG, or SVG) with a size of 512x512 or more, and then go to the online tool [**Real Favicon Generator**](https://realfavicongenerator.net/) and click the button <kbd>Select your Favicon image</kbd> to upload your image file.
In the next step, the webpage will show all usage scenarios. You can keep the default options, scroll to the bottom of the page, and click the button <kbd>Generate your Favicons and HTML code</kbd> to generate the favicon.
## Download & Replace
Download the generated package, unzip and delete the following two from the extracted files:
- `browserconfig.xml`{: .filepath}
- `site.webmanifest`{: .filepath}
And then copy the remaining image files (`.PNG`{: .filepath} and `.ICO`{: .filepath}) to cover the original files in the directory `assets/img/favicons/`{: .filepath} of your Jekyll site. If your Jekyll site doesn't have this directory yet, just create one.
The following table will help you understand the changes to the favicon files:
| File(s) | From Online Tool | From Chirpy |
|---------------------|:---------------------------------:|:-----------:|
| `*.PNG` | ✓ | ✗ |
| `*.ICO` | ✓ | ✗ |
<!-- markdownlint-disable-next-line -->
> ✓ means keep, ✗ means delete.
{: .prompt-info }
The next time you build the site, the favicon will be replaced with a customized edition.

View File

@ -129,11 +129,6 @@ 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;
@ -369,6 +364,7 @@ main {
h1 {
margin-top: 2rem;
margin-bottom: 1.5rem;
}
p {
@ -554,32 +550,17 @@ 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,6 +104,10 @@
display: none;
}
hr {
border-color: var(--main-border-color);
}
/* categories */
.categories.card,
.list-group-item {

View File

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

View File

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

View File

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

4
assets/js/dist/categories.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const o=$(".mode-toggle");function s(o){var s=function(o,s){if("object"!=typeof o||!o)return o;var t=o[Symbol.toPrimitive];if(void 0!==t){var e=t.call(o,s||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===s?String:Number)(o)}(o,"string");return"symbol"==typeof s?s:s+""}function t(o,t,e){return(t=s(t))in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}const e=$("body"),a="sidebar-display";class r{static toggle(){!1===r.isExpanded?e.attr(a,""):e.removeAttr(a),r.isExpanded=!r.isExpanded}}t(r,"isExpanded",!1);const l=$("#sidebar-trigger"),n=$("#search-trigger"),i=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),f=$("#topbar-title"),d=$("search"),u=$("#search-result-wrapper"),p=$("#search-results"),b=$("#search-input"),m=$("#search-hints"),g=$("html,body"),C="loaded",v="unloaded",h="input-focus",w="d-flex";class y{static on(){y.offset=window.scrollY,g.scrollTop(0)}static off(){g.scrollTop(y.offset)}}t(y,"offset",0),t(y,"resultVisible",!1);class k{static on(){l.addClass(v),f.addClass(v),n.addClass(v),d.addClass(w),i.addClass(C)}static off(){i.removeClass(C),d.removeClass(w),l.removeClass(v),f.removeClass(v),n.removeClass(v)}}class T{static on(){y.resultVisible||(y.on(),u.removeClass(v),c.addClass(v),y.resultVisible=!0)}static off(){y.resultVisible&&(p.empty(),m.hasClass(v)&&m.removeClass(v),u.addClass(v),c.removeClass(v),y.off(),b.val(""),y.resultVisible=!1)}}function x(){return i.hasClass(C)}const E=$(".collapse");$(".code-header>button").children().attr("class"),function(){const o=$(window),s=$("#back-to-top");o.on("scroll",(()=>{o.scrollTop()>50?s.fadeIn():s.fadeOut()})),s.on("click",(()=>{o.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((o=>new bootstrap.Tooltip(o))),0!==o.length&&o.off().on("click",(o=>{const s=$(o.target);let t=s.prop("tagName")==="button".toUpperCase()?s:s.parent();modeToggle.flipMode(),t.trigger("blur")})),$("#sidebar-trigger").on("click",r.toggle),$("#mask").on("click",r.toggle),n.on("click",(function(){k.on(),T.on(),b.trigger("focus")})),i.on("click",(function(){k.off(),T.off()})),b.on("focus",(function(){d.addClass(h)})),b.on("focusout",(function(){d.removeClass(h)})),b.on("input",(()=>{""===b.val()?x()?m.removeClass(v):T.off():(T.on(),x()&&m.addClass(v))})),E.on("hide.bs.collapse",(function(){const o="h_"+$(this).attr("id").substring(2);o&&($("#".concat(o," .far.fa-folder-open")).attr("class","far fa-folder fa-fw"),$("#".concat(o," i.fas")).addClass("rotate"),$("#".concat(o)).removeClass("hide-border-bottom"))})),E.on("show.bs.collapse",(function(){const o="h_"+$(this).attr("id").substring(2);o&&($("#".concat(o," .far.fa-folder")).attr("class","far fa-folder-open fa-fw"),$("#".concat(o," i.fas")).removeClass("rotate"),$("#".concat(o)).addClass("hide-border-bottom"))}))}();

4
assets/js/dist/commons.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const e=$(".mode-toggle");function s(e){var s=function(e,s){if("object"!=typeof e||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var t=o.call(e,s||"default");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===s?String:Number)(e)}(e,"string");return"symbol"==typeof s?s:s+""}function o(e,o,t){return(o=s(o))in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}const t=$("body"),r="sidebar-display";class a{static toggle(){!1===a.isExpanded?t.attr(r,""):t.removeAttr(r),a.isExpanded=!a.isExpanded}}o(a,"isExpanded",!1);const l=$("#sidebar-trigger"),i=$("#search-trigger"),n=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),d=$("#topbar-title"),f=$("search"),u=$("#search-result-wrapper"),p=$("#search-results"),g=$("#search-input"),m=$("#search-hints"),b=$("html,body"),v="loaded",C="unloaded",h="input-focus",y="d-flex";class w{static on(){w.offset=window.scrollY,b.scrollTop(0)}static off(){b.scrollTop(w.offset)}}o(w,"offset",0),o(w,"resultVisible",!1);class k{static on(){l.addClass(C),d.addClass(C),i.addClass(C),f.addClass(y),n.addClass(v)}static off(){n.removeClass(v),f.removeClass(y),l.removeClass(C),d.removeClass(C),i.removeClass(C)}}class T{static on(){w.resultVisible||(w.on(),u.removeClass(C),c.addClass(C),w.resultVisible=!0)}static off(){w.resultVisible&&(p.empty(),m.hasClass(C)&&m.removeClass(C),u.addClass(C),c.removeClass(C),w.off(),g.val(""),w.resultVisible=!1)}}function x(){return n.hasClass(v)}!function(){const e=$(window),s=$("#back-to-top");e.on("scroll",(()=>{e.scrollTop()>50?s.fadeIn():s.fadeOut()})),s.on("click",(()=>{e.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((e=>new bootstrap.Tooltip(e))),0!==e.length&&e.off().on("click",(e=>{const s=$(e.target);let o=s.prop("tagName")==="button".toUpperCase()?s:s.parent();modeToggle.flipMode(),o.trigger("blur")})),$("#sidebar-trigger").on("click",a.toggle),$("#mask").on("click",a.toggle),i.on("click",(function(){k.on(),T.on(),g.trigger("focus")})),n.on("click",(function(){k.off(),T.off()})),g.on("focus",(function(){f.addClass(h)})),g.on("focusout",(function(){f.removeClass(h)})),g.on("input",(()=>{""===g.val()?x()?m.removeClass(C):T.off():(T.on(),x()&&m.addClass(C))}))}();

4
assets/js/dist/home.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const t=$(".mode-toggle");function e(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var s=a.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function a(t,a,s){return(a=e(a))in t?Object.defineProperty(t,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[a]=s,t}const s=$("body"),o="sidebar-display";class r{static toggle(){!1===r.isExpanded?s.attr(o,""):s.removeAttr(o),r.isExpanded=!r.isExpanded}}a(r,"isExpanded",!1);const i=$("#sidebar-trigger"),l=$("#search-trigger"),n=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),d=$("#topbar-title"),u=$("search"),m=$("#search-result-wrapper"),f=$("#search-results"),p=$("#search-input"),g=$("#search-hints"),h=$("html,body"),b="loaded",v="unloaded",C="input-focus",y="d-flex";class w{static on(){w.offset=window.scrollY,h.scrollTop(0)}static off(){h.scrollTop(w.offset)}}a(w,"offset",0),a(w,"resultVisible",!1);class T{static on(){i.addClass(v),d.addClass(v),l.addClass(v),u.addClass(y),n.addClass(b)}static off(){n.removeClass(b),u.removeClass(y),i.removeClass(v),d.removeClass(v),l.removeClass(v)}}class k{static on(){w.resultVisible||(w.on(),m.removeClass(v),c.addClass(v),w.resultVisible=!0)}static off(){w.resultVisible&&(f.empty(),g.hasClass(v)&&g.removeClass(v),m.addClass(v),c.removeClass(v),w.off(),p.val(""),w.resultVisible=!1)}}function x(){return n.hasClass(b)}$(".collapse");$(".code-header>button").children().attr("class");const E="data-src",j="data-lqip",M={SHIMMER:"shimmer",BLUR:"blur"};function A(t){$(this).parent().removeClass(t)}function F(){this.complete&&(this.hasAttribute(j)?A.call(this,M.BLUR):A.call(this,M.SHIMMER))}function R(){const t=$(this),e=t.attr(E);t.attr("src",encodeURI(e)),t.removeAttr(E)}class S{static get attrTimestamp(){return"data-ts"}static get attrDateFormat(){return"data-df"}static get locale(){return $("html").attr("lang").substring(0,2)}static getTimestamp(t){return Number(t.attr(S.attrTimestamp))}static getDateFormat(t){return t.attr(S.attrDateFormat)}}!function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t))),0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let a=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),a.trigger("blur")})),$("#sidebar-trigger").on("click",r.toggle),$("#mask").on("click",r.toggle),l.on("click",(function(){T.on(),k.on(),p.trigger("focus")})),n.on("click",(function(){T.off(),k.off()})),p.on("focus",(function(){u.addClass(C)})),p.on("focusout",(function(){u.removeClass(C)})),p.on("input",(()=>{""===p.val()?x()?g.removeClass(v):k.off():(k.on(),x()&&g.addClass(v))})),dayjs.locale(S.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(S.attrTimestamp,"]")).each((function(){const t=dayjs.unix(S.getTimestamp($(this))),e=t.format(S.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(S.attrTimestamp),$(this).removeAttr(S.attrDateFormat);const a=$(this).attr("data-bs-toggle");if(void 0===a||"tooltip"!==a)return;const s=t.format("llll");$(this).attr("data-bs-title",s),new bootstrap.Tooltip($(this))})),function(){const t=$("article img");t.length&&t.on("load",F),$('article img[loading="lazy"]').each((function(){this.complete&&A.call(this,M.SHIMMER)}));const e=$("article img[".concat(j,'="true"]'));e.length&&e.each(R)}()}();

4
assets/js/dist/misc.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const t=$(".mode-toggle");function e(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var s=a.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function a(t,a,s){return(a=e(a))in t?Object.defineProperty(t,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[a]=s,t}const s=$("body"),o="sidebar-display";class r{static toggle(){!1===r.isExpanded?s.attr(o,""):s.removeAttr(o),r.isExpanded=!r.isExpanded}}a(r,"isExpanded",!1);const l=$("#sidebar-trigger"),i=$("#search-trigger"),n=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),d=$("#topbar-title"),u=$("search"),f=$("#search-result-wrapper"),m=$("#search-results"),p=$("#search-input"),g=$("#search-hints"),b=$("html,body"),h="loaded",v="unloaded",C="input-focus",y="d-flex";class w{static on(){w.offset=window.scrollY,b.scrollTop(0)}static off(){b.scrollTop(w.offset)}}a(w,"offset",0),a(w,"resultVisible",!1);class T{static on(){l.addClass(v),d.addClass(v),i.addClass(v),u.addClass(y),n.addClass(h)}static off(){n.removeClass(h),u.removeClass(y),l.removeClass(v),d.removeClass(v),i.removeClass(v)}}class k{static on(){w.resultVisible||(w.on(),f.removeClass(v),c.addClass(v),w.resultVisible=!0)}static off(){w.resultVisible&&(m.empty(),g.hasClass(v)&&g.removeClass(v),f.addClass(v),c.removeClass(v),w.off(),p.val(""),w.resultVisible=!1)}}function x(){return n.hasClass(h)}$(".collapse");$(".code-header>button").children().attr("class");class j{static get attrTimestamp(){return"data-ts"}static get attrDateFormat(){return"data-df"}static get locale(){return $("html").attr("lang").substring(0,2)}static getTimestamp(t){return Number(t.attr(j.attrTimestamp))}static getDateFormat(t){return t.attr(j.attrDateFormat)}}!function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t))),0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let a=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),a.trigger("blur")})),$("#sidebar-trigger").on("click",r.toggle),$("#mask").on("click",r.toggle),i.on("click",(function(){T.on(),k.on(),p.trigger("focus")})),n.on("click",(function(){T.off(),k.off()})),p.on("focus",(function(){u.addClass(C)})),p.on("focusout",(function(){u.removeClass(C)})),p.on("input",(()=>{""===p.val()?x()?g.removeClass(v):k.off():(k.on(),x()&&g.addClass(v))})),dayjs.locale(j.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(j.attrTimestamp,"]")).each((function(){const t=dayjs.unix(j.getTimestamp($(this))),e=t.format(j.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(j.attrTimestamp),$(this).removeAttr(j.attrDateFormat);const a=$(this).attr("data-bs-toggle");if(void 0===a||"tooltip"!==a)return;const s=t.format("llll");$(this).attr("data-bs-title",s),new bootstrap.Tooltip($(this))}))}();

4
assets/js/dist/page.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/*!
* Chirpy v6.5.5 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const t=$(".mode-toggle");function e(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var s=o.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function o(t,o,s){return(o=e(o))in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}const s=$("body"),a="sidebar-display";class n{static toggle(){!1===n.isExpanded?s.attr(a,""):s.removeAttr(a),n.isExpanded=!n.isExpanded}}o(n,"isExpanded",!1);const r=$("#sidebar-trigger"),i=$("#search-trigger"),l=$("#search-cancel"),c=$("#main-wrapper>.container>.row"),u=$("#topbar-title"),d=$("search"),f=$("#search-result-wrapper"),p=$("#search-results"),m=$("#search-input"),g=$("#search-hints"),h=$("html,body"),b="loaded",v="unloaded",C="input-focus",w="d-flex";class y{static on(){y.offset=window.scrollY,h.scrollTop(0)}static off(){h.scrollTop(y.offset)}}o(y,"offset",0),o(y,"resultVisible",!1);class k{static on(){r.addClass(v),u.addClass(v),i.addClass(v),d.addClass(w),l.addClass(b)}static off(){l.removeClass(b),d.removeClass(w),r.removeClass(v),u.removeClass(v),i.removeClass(v)}}class S{static on(){y.resultVisible||(y.on(),f.removeClass(v),c.addClass(v),y.resultVisible=!0)}static off(){y.resultVisible&&(p.empty(),g.hasClass(v)&&g.removeClass(v),f.addClass(v),c.removeClass(v),y.off(),m.val(""),y.resultVisible=!1)}}function T(){return l.hasClass(b)}$(".collapse");const E=".code-header>button",A="fas fa-check",x="timeout",M="data-title-succeed",R="data-bs-original-title",I=2e3;function V(t){if($(t)[0].hasAttribute(x)){let e=$(t).attr(x);if(Number(e)>Date.now())return!0}return!1}function q(t){$(t).attr(x,Date.now()+I)}function N(t){$(t).removeAttr(x)}const P=$(E).children().attr("class");const U="data-src",j="data-lqip",B={SHIMMER:"shimmer",BLUR:"blur"};function H(t){$(this).parent().removeClass(t)}function O(){this.complete&&(this.hasAttribute(j)?H.call(this,B.BLUR):H.call(this,B.SHIMMER))}function z(){const t=$(this),e=t.attr(U);t.attr("src",encodeURI(e)),t.removeAttr(U)}!function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t))),0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),o.trigger("blur")})),$("#sidebar-trigger").on("click",n.toggle),$("#mask").on("click",n.toggle),i.on("click",(function(){k.on(),S.on(),m.trigger("focus")})),l.on("click",(function(){k.off(),S.off()})),m.on("focus",(function(){d.addClass(C)})),m.on("focusout",(function(){d.removeClass(C)})),m.on("input",(()=>{""===m.val()?T()?g.removeClass(v):S.off():(S.on(),T()&&g.addClass(v))})),function(){const t=$("article img");t.length&&t.on("load",O),$('article img[loading="lazy"]').each((function(){this.complete&&H.call(this,B.SHIMMER)}));const e=$("article img[".concat(j,'="true"]'));e.length&&e.each(z)}(),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),function(){if($(E).length){const t=new ClipboardJS(E,{target:t=>t.parentNode.nextElementSibling.querySelector("code .rouge-code")});[...document.querySelectorAll(E)].map((t=>new bootstrap.Tooltip(t,{placement:"left"}))),t.on("success",(t=>{t.clearSelection();const e=t.trigger;V(e)||(!function(t){$(t).children().attr("class",A)}(e),function(t){const e=$(t).attr(M);$(t).attr(R,e).tooltip("show")}(e),q(e),setTimeout((()=>{!function(t){$(t).tooltip("hide").removeAttr(R)}(e),function(t){$(t).children().attr("class",P)}(e),N(e)}),I))}))}const t=$("#copy-link");t.on("click",(t=>{let e=$(t.target);V(e)||navigator.clipboard.writeText(window.location.href).then((()=>{const t=e.attr(R),o=e.attr(M);e.attr(R,o).tooltip("show"),q(e),setTimeout((()=>{e.attr(R,t),N(e)}),I)}))})),t.on("mouseleave",(function(t){$(t.target).tooltip("hide")}))}()}();

4
assets/js/dist/post.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -21,18 +21,18 @@
"fixlint": "npm run test -- --fix"
},
"devDependencies": {
"@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",
"@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",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.4",
"husky": "^9.0.11",
"rimraf": "^5.0.5",
"rollup": "^4.13.2",
"rollup-plugin-license": "^3.3.1",
"stylelint": "^16.3.1",
"rollup": "^4.10.0",
"rollup-plugin-license": "^3.2.0",
"stylelint": "^16.2.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-transform-class-properties']
plugins: ['@babel/plugin-proposal-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/^cdn:.*/cdn:/;s/^avatar:.*/avatar:/" _config.yml
_sedi "s/^img_cdn:.*/img_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/^cdn:.*/cdn:/;s/^avatar:.*/avatar:/" _config.yml
sed -i "s/^img_cdn:.*/img_cdn:/;s/^avatar:.*/avatar:/" _config.yml
rm -f ./*.gem
npm run build