forked from cotes2020/jekyll-theme-chirpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Juzi
committed
Mar 8, 2024
1 parent
f6e9550
commit f81438d
Showing
8 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ko_fi: coteschung | ||
custom: https://sponsor.cotes.page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: "Build and Deploy" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
paths-ignore: | ||
- .gitignore | ||
- README.md | ||
- LICENSE | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
# submodules: true | ||
# If using the 'assets' git submodule from Chirpy Starter, uncomment above | ||
# (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets) | ||
|
||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.2 | ||
bundler-cache: true | ||
|
||
- name: Build site | ||
run: bundle exec jekyll b -d "_site${{ steps.pages.outputs.base_path }}" | ||
env: | ||
JEKYLL_ENV: "production" | ||
|
||
- name: Test site | ||
run: | | ||
bundle exec htmlproofer _site \ | ||
\-\-disable-external=true \ | ||
\-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/" | ||
|
||
- name: Upload site artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: "_site${{ steps.pages.outputs.base_path }}" | ||
|
||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ package-lock.json | |
.idea | ||
|
||
# Misc | ||
assets/js/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"commands-show-output": false, | ||
"blanks-around-fences": false, | ||
"line-length": false, | ||
"no-inline-html": { | ||
"allowed_elements": ["kbd", "sub"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% assign video_url = include.src %} | ||
{% assign poster_url = include.poster %} | ||
|
||
{% unless video_url contains '://' %} | ||
{%- capture video_url -%} | ||
{% include img-url.html src=video_url img_path=page.img_path %} | ||
{%- endcapture -%} | ||
{% endunless %} | ||
|
||
{% if poster_url %} | ||
{% unless poster_url contains '://' %} | ||
{%- capture poster_url -%} | ||
{% include img-url.html src=poster_url img_path=page.img_path %} | ||
{%- 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" src="{{ video_url }}" {{ poster }} {{ attributes }}> | ||
Your browser doesn't support HTML video. Here is a <a href="{{ video_url }}">link to the video</a> instead. | ||
</video> | ||
<em>{{ include.title }}</em> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |