mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 21:53:26 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b04bb847b1 | ||
|
|
6ef97f1fad | ||
|
|
18bd1a91ef | ||
|
|
4dd4915bed | ||
|
|
a227ae386d | ||
|
|
32bd36f016 | ||
|
|
aa23becd14 | ||
|
|
b2f0b4cb1b | ||
|
|
209058b84a | ||
|
|
562fcd4fd8 | ||
|
|
22115f3797 | ||
|
|
9f3619e54a | ||
|
|
5b0aaa5403 | ||
|
|
733bb0fbfa | ||
|
|
0d47beba97 | ||
|
|
c0ba181246 | ||
|
|
313c44f238 |
16
.github/CONTRIBUTING.md
vendored
16
.github/CONTRIBUTING.md
vendored
@@ -2,15 +2,21 @@
|
||||
|
||||
I want to thank you for sparing a time to improve this project! Here are some guidelines for contributing:
|
||||
|
||||
To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a `Feature Request` type issue to discuss whether your idea fits the project.
|
||||
To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [`Feature Request`](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project.
|
||||
|
||||
Generally, contribute to the project by:
|
||||
|
||||
1. Fork this project.
|
||||
2. Create a new branch `my-new-feature`(or `fix-a-bug`), then complete the development, commit and push.
|
||||
3. Submit a new `Pull Request`.
|
||||
1. Fork this project on GitHub and clone it locally.
|
||||
2. Create a new branch named `feature/my-feature` (or `feature/fix-a-bug`), which branch from `develop`:
|
||||
|
||||
```console
|
||||
$ git checkout -b feature/<my-feature> develop
|
||||
```
|
||||
> Please note that the new branch name must include the prefix `feature/`.
|
||||
|
||||
3. After completing the development, commit and push to remote.
|
||||
4. Submit a new **pull request** to the `develop` branch of upstream, i.e., `cotes2020/jekyll-theme-chirpy:develop`.
|
||||
|
||||
---
|
||||
|
||||
:tada:Your volunteering will make the open source world more beautiful, thanks again!:tada:
|
||||
:tada: Your volunteering will make the open source world more beautiful, thanks again! :tada:
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -11,7 +11,7 @@ labels: enhancement
|
||||
- [ ] I have read the [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/CONTRIBUTING.md).
|
||||
- [ ] There are no similar request on existing issues (including closed ones).
|
||||
- [ ] I have read the [project progress](https://github.com/cotes2020/jekyll-theme-chirpy/projects) and know the current progress of the project.
|
||||
- [ ] I was in the `master` branch of the latest code.
|
||||
- [ ] I was in the `develop` branch of the latest code.
|
||||
|
||||
|
||||
## Is your feature request related to a problem? Please describe
|
||||
|
||||
14
.github/ISSUE_TEMPLATE/question.md
vendored
14
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -7,20 +7,14 @@ labels: question
|
||||
<!-- Note: Please follow the template to open a new issue, otherwise your question will probably be ignored. -->
|
||||
|
||||
## Checklist
|
||||
|
||||
<!-- Please complete the following list of tasks, and then check it by change the "[ ]" to "[x]" -->
|
||||
|
||||
- [ ] I have read the [tutorials](https://chirpy.cotes.info/categories/tutorial/) and know the correct effect of the functional design.
|
||||
- [ ] There are no similar question on existing issues (including closed ones).
|
||||
- [ ] I searched the Internet for related problems, but still couldn't solve it.
|
||||
- [ ] My question is based on the latest code of `master` branch.
|
||||
|
||||
|
||||
## I don't understand what the ReadMe/Wiki says
|
||||
<!--
|
||||
Point out the parts that are hard for you to understand.
|
||||
-->
|
||||
|
||||
|
||||
## I have other questions
|
||||
<!--
|
||||
Please describe your question.
|
||||
-->
|
||||
## Description
|
||||
<!-- Please describe your question. -->
|
||||
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,11 +1,10 @@
|
||||
# Description
|
||||
## 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.
|
||||
-->
|
||||
|
||||
Fixes #(issue)
|
||||
|
||||
e.g. Fixes #(issue)
|
||||
|
||||
## Type of change
|
||||
|
||||
@@ -17,7 +16,7 @@ Please select the desired item checkbox and change it to "[x]", then delete opti
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Documentation update
|
||||
|
||||
# How Has This Been Tested?
|
||||
## How has this been tested?
|
||||
|
||||
<!--
|
||||
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
|
||||
@@ -26,16 +25,16 @@ Please describe the tests that you ran to verify your changes. Provide instructi
|
||||
- [ ] I have run `bash ./tools/build.sh && bash ./tools/test.sh` (at the root of the project) locally and passed
|
||||
- [ ] I have tested this feature in the browser
|
||||
|
||||
## Test Configuration
|
||||
**Test Configuration**
|
||||
|
||||
* Browerser type & version:
|
||||
* Operating system:
|
||||
* Bundler version:
|
||||
* Ruby version:
|
||||
* Jekyl version:
|
||||
* Jekyll version:
|
||||
|
||||
|
||||
# Checklist:
|
||||
## Checklist:
|
||||
<!-- Select checkboxes by change the "[ ]" to "[x]" -->
|
||||
- [ ] My code follows the [Google style guidelines](https://google.github.io/styleguide/)
|
||||
- [ ] I have performed a self-review of my own code
|
||||
|
||||
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -1,8 +1,8 @@
|
||||
name: 'Continuous Integration'
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- stable
|
||||
branches:
|
||||
- '*'
|
||||
tags-ignore:
|
||||
- '*'
|
||||
paths-ignore:
|
||||
@@ -15,7 +15,7 @@ on:
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
paths:
|
||||
- "**"
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
|
||||
@@ -23,7 +23,7 @@ script:
|
||||
- bash _cibuild.sh
|
||||
|
||||
branches:
|
||||
only: stable
|
||||
only: master
|
||||
|
||||
git:
|
||||
depth: false # for posts lastmod
|
||||
|
||||
25
README.md
25
README.md
@@ -47,15 +47,15 @@ To improve the writing experience, we need to use some script tools. If your mac
|
||||
|
||||
* Debian
|
||||
|
||||
```console
|
||||
$ sudo apt-get install coreutils
|
||||
```
|
||||
```console
|
||||
$ sudo apt-get install coreutils
|
||||
```
|
||||
|
||||
* macOS
|
||||
|
||||
```console
|
||||
$ brew install coreutils
|
||||
```
|
||||
```console
|
||||
$ brew install coreutils
|
||||
```
|
||||
|
||||
|
||||
### Jekyll Plugins
|
||||
@@ -66,7 +66,7 @@ $ brew install coreutils
|
||||
$ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master
|
||||
```
|
||||
|
||||
and replace the `USER` above to your GitHub username.
|
||||
And replace the `USER` above to your GitHub username.
|
||||
|
||||
The first time you run or build the project on local machine, perform the installation of Jekyll plugins. Go to the root of repo and run:
|
||||
|
||||
@@ -82,7 +82,7 @@ $ bundle install
|
||||
|
||||
### Directory Structure
|
||||
|
||||
The main files and related brief introductions are listed below.
|
||||
The main files and related brief introductions are listed below:
|
||||
|
||||
```sh
|
||||
jekyll-theme-chirpy/
|
||||
@@ -113,8 +113,9 @@ jekyll-theme-chirpy/
|
||||
|
||||
As mentioned above, some files or directories should be removed from your repo:
|
||||
|
||||
- .travis.yml
|
||||
- .github
|
||||
```terminal
|
||||
$ rm -rf .travis.yml .github _posts/*
|
||||
```
|
||||
|
||||
|
||||
### Configuration
|
||||
@@ -164,7 +165,7 @@ Before the deployment begins, checkout the file `_config.yml` and make sure that
|
||||
|
||||
By deploying the site in this way, you're allowed to push the source code directly to the remote.
|
||||
|
||||
> **Note**: If you want to use any third-party Jekyll plugins that not in [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
||||
> **Note**: If you want to use any third-party Jekyll plugins that not on [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
||||
|
||||
**1**. Rename the repository to:
|
||||
|
||||
@@ -202,7 +203,7 @@ it will automatically generates the *Latest Modified Date* and *Categories / Tag
|
||||
|
||||
#### Option 2: Build Locally
|
||||
|
||||
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any another plugins that not in the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
||||
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any other plugin that not on the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
||||
|
||||
**1**. Browse to GitHub website, create a brand new repo named:
|
||||
|
||||
|
||||
@@ -6,4 +6,6 @@
|
||||
|
||||
|
||||
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
|
||||
post: "%b %e, %Y"
|
||||
post:
|
||||
long: "%b %e, %Y"
|
||||
short: "%b %e"
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
https://github.com/penibelst/jekyll-compress-html/issues/101
|
||||
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
|
||||
-->
|
||||
{% if _content contains '<pre class="highlight">' %}
|
||||
{% assign _content = _content | replace: '<pre class="highlight"><code', '<code' %}
|
||||
{% assign _content = _content | replace: '</code></pre>', '</code>' %}
|
||||
{% endif %}
|
||||
{% if include.content contains '<pre class="highlight">' %}
|
||||
{% assign content = include.content | replace: '<pre class="highlight"><code', '<code' %}
|
||||
{% assign content = content | replace: '</code></pre>', '</code>' %}
|
||||
{{ content }}
|
||||
{% else %}
|
||||
{{ include.content }}
|
||||
{% endif %}
|
||||
|
||||
@@ -8,18 +8,10 @@
|
||||
|
||||
{% if page.layout == 'home' %}
|
||||
|
||||
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
|
||||
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script>
|
||||
|
||||
{% elsif page.layout == 'post' %}
|
||||
|
||||
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
|
||||
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></script>
|
||||
|
||||
{% if page.math %}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
{% comment %}
|
||||
Remove line numbers from code snippets.
|
||||
Remove the line number of the code snippet.
|
||||
v2.2
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
Published under the MIT License
|
||||
{% endcomment %}
|
||||
|
||||
{% if _content contains '<td class="rouge-gutter gl"><pre class="lineno">' %}
|
||||
{% assign _content = _content | replace: '<td class="rouge-gutter gl"><pre class="lineno">', '<!-- <td class="rouge-gutter gl"><pre class="lineno">'%}
|
||||
{% assign _content = _content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' %}
|
||||
{% assign content = include.content %}
|
||||
|
||||
{% if content contains '<td class="rouge-gutter gl"><pre class="lineno">' %}
|
||||
{% assign content = content | replace: '<td class="rouge-gutter gl"><pre class="lineno">', '<!-- <td class="rouge-gutter gl"><pre class="lineno">'%}
|
||||
{% assign content = content | replace: '</td><td class="rouge-code">', '</td> --><td class="rouge-code">' %}
|
||||
{% endif %}
|
||||
|
||||
@@ -23,17 +23,12 @@
|
||||
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
|
||||
|
||||
{% for item in update_list %}
|
||||
{% assign post_url = item | split: "::" | last | prepend: "/posts/" | append: "/" %}
|
||||
{% assign post_url = item | split: "::" | last | url_encode | prepend: "/posts/" | append: "/" %}
|
||||
{% assign post = site.posts | where: "url", post_url | first %}
|
||||
|
||||
{% if post %}
|
||||
{% assign url = post.url | relative_url %}
|
||||
|
||||
<li><a href="{{ url }}">{{ post.title }}</a></li>
|
||||
|
||||
{% assign sum = sum | plus: 1 %}
|
||||
{% if sum >= MAX_SIZE %} {% break %} {% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
@@ -93,15 +93,13 @@
|
||||
<div class="card">
|
||||
<a href="{{ post.url | relative_url }}">
|
||||
<div class="card-body">
|
||||
<span class="timeago small">
|
||||
{{ post.date | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
|
||||
</span>
|
||||
{% include timeago.html date=post.date class="small" %}
|
||||
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
|
||||
<div class="text-muted small">
|
||||
{% assign content = post.content %}
|
||||
{% include no-linenos.html %}
|
||||
<p>{{ content | markdownify | strip_html | truncate: 200 | replace: '&', '&' }}</p>
|
||||
<p>
|
||||
{% include no-linenos.html content=post.content %}
|
||||
{{ content | markdownify | strip_html | truncate: 200 }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
<div class="col-12 col-xl-11 post-content">
|
||||
<div id="search-hints">
|
||||
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags }}</h4>
|
||||
|
||||
{% include trending-tags.html %}
|
||||
|
||||
{% for tag in trending_tags %}
|
||||
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %}
|
||||
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
<div id="search-results" class="d-flex flex-wrap justify-content-center text-muted mt-3"></div>
|
||||
</div>
|
||||
|
||||
27
_includes/timeago.html
Normal file
27
_includes/timeago.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
Date format snippet
|
||||
|
||||
v2.4.1
|
||||
https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
© 2020 Cotes Chung
|
||||
MIT License
|
||||
-->
|
||||
<span class="timeago {% if include.class %}{{ include.class }}{% endif %}"
|
||||
{% if include.tooltip %}
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
title="{{ include.date | date: site.data.date_format.tooltip }}"
|
||||
{% endif %}>
|
||||
|
||||
{% assign this_year = site.time | date: "%Y" %}
|
||||
{% assign post_year = include.date | date: "%Y" %}
|
||||
|
||||
{% if post_year == this_year %}
|
||||
{{ include.date | date: site.data.date_format.post.short }}
|
||||
{% else %}
|
||||
{{ include.date | date: site.data.date_format.post.long }}
|
||||
{% endif %}
|
||||
|
||||
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
|
||||
|
||||
</span>
|
||||
@@ -7,15 +7,20 @@
|
||||
{% endcomment %}
|
||||
|
||||
{% assign MAX_SIZE = 5 %}
|
||||
{% assign sum = 0 %}
|
||||
{% assign update_list = "" | split: "" %}
|
||||
|
||||
{% assign all_list = "" | split: "" %}
|
||||
|
||||
{% for entry in site.data.updates %}
|
||||
{% capture elem %}
|
||||
{{- entry.lastmod -}}::{{- entry.filename -}}
|
||||
{% endcapture %}
|
||||
|
||||
{% assign update_list = update_list | push: elem %}
|
||||
{% assign all_list = all_list | push: elem %}
|
||||
{% endfor %}
|
||||
|
||||
{% assign update_list = update_list | sort | reverse %}
|
||||
{% assign all_list = all_list | sort | reverse %}
|
||||
|
||||
{% assign update_list = "" | split: "" %}
|
||||
|
||||
{% for entry in all_list limit:MAX_SIZE %}
|
||||
{% assign update_list = update_list | push: entry %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -18,7 +18,7 @@ layout: page
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -36,15 +36,12 @@ layout: compress
|
||||
<div id="main-wrapper">
|
||||
<div id="main">
|
||||
|
||||
{% capture _content %}
|
||||
{{ content }}
|
||||
{% endcapture %}
|
||||
|
||||
{% include fixlinenos.html %}
|
||||
{{ _content }}
|
||||
{% include fixlinenos.html content=content %}
|
||||
|
||||
{% include footer.html %}
|
||||
|
||||
</div>
|
||||
|
||||
{% include search-results.html %}
|
||||
|
||||
</div> <!-- #main-wrapper -->
|
||||
|
||||
@@ -58,20 +58,16 @@ layout: page
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<p>
|
||||
{% assign _content = post.content %}
|
||||
{% include no-linenos.html %}
|
||||
{{ _content | markdownify | strip_html | truncate: 200 }}
|
||||
{% include no-linenos.html content=post.content %}
|
||||
{{ content | markdownify | strip_html | truncate: 200 }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="post-meta text-muted">
|
||||
<!-- posted date -->
|
||||
<i class="far fa-clock fa-fw"></i>
|
||||
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
|
||||
title="{{ post.date | date: site.data.date_format.tooltip }}">
|
||||
{{ post.date | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
|
||||
</span>
|
||||
{% include timeago.html date=post.date tooltip=true %}
|
||||
|
||||
<!-- page views -->
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
<i class="far fa-eye fa-fw"></i>
|
||||
|
||||
@@ -19,16 +19,12 @@ layout: default
|
||||
<!-- Published date and author -->
|
||||
<div>
|
||||
Posted
|
||||
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
|
||||
title="{{ page.date | date: site.data.date_format.tooltip }}">
|
||||
{{ page.date | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ page.date | date_to_xmlschema }}</i>
|
||||
</span>
|
||||
{% include timeago.html date=page.date tooltip=true %}
|
||||
by
|
||||
<span class="author">
|
||||
{% if page.author %}
|
||||
{{ page.author }}
|
||||
{% else%}
|
||||
{% else %}
|
||||
{{ site.author }}
|
||||
{% endif %}
|
||||
</span>
|
||||
@@ -39,17 +35,18 @@ layout: default
|
||||
{{ page.url | split: "/" | last }}
|
||||
{%- endcapture -%}
|
||||
|
||||
{% assign record = site.data.updates | where: "filename", filename | first %}
|
||||
{% for item in site.data.updates %}
|
||||
{% assign encode_filename = item.filename | url_encode %}
|
||||
{% if filename == encode_filename %}
|
||||
{% assign lastmod = item.lastmod %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if record %}
|
||||
{% if lastmod %}
|
||||
<div>
|
||||
Updated
|
||||
<span class="timeago lastmod"
|
||||
data-toggle="tooltip" data-placement="bottom"
|
||||
title="{{ record.lastmod | date: site.data.date_format.tooltip }}">
|
||||
{{ record.lastmod | date: site.data.date_format.post }}
|
||||
<i class="unloaded">{{ record.lastmod | date_to_xmlschema}}</i>
|
||||
</span>
|
||||
{% include timeago.html date=lastmod class="lastmod" tooltip=true %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ layout: page
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post }}</span>
|
||||
<span class="text-muted small">{{ post.date | date: site.data.date_format.post.long }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -15,15 +15,15 @@ To improve the writing experience, we need to use some script tools. If your mac
|
||||
|
||||
* Debian
|
||||
|
||||
```console
|
||||
$ sudo apt-get install coreutils
|
||||
```
|
||||
```console
|
||||
$ sudo apt-get install coreutils
|
||||
```
|
||||
|
||||
* macOS
|
||||
|
||||
```console
|
||||
$ brew install coreutils
|
||||
```
|
||||
```console
|
||||
$ brew install coreutils
|
||||
```
|
||||
|
||||
|
||||
## Jekyll Plugins
|
||||
@@ -34,7 +34,7 @@ $ brew install coreutils
|
||||
$ git clone git@github.com:USER/jekyll-theme-chirpy.git -b master
|
||||
```
|
||||
|
||||
and replace the `USER` above to your GitHub username.
|
||||
And replace the `USER` above to your GitHub username.
|
||||
|
||||
The first time you run or build the project on local machine, perform the installation of Jekyll plugins. Go to the root of repo and run:
|
||||
|
||||
@@ -47,7 +47,7 @@ $ bundle install
|
||||
|
||||
## Directory Structure
|
||||
|
||||
The main files and related brief introductions are listed below.
|
||||
The main files and related brief introductions are listed below:
|
||||
|
||||
```sh
|
||||
jekyll-theme-chirpy/
|
||||
@@ -77,9 +77,9 @@ jekyll-theme-chirpy/
|
||||
|
||||
As mentioned above, some files or directories should be removed from your repo:
|
||||
|
||||
- .travis.yml
|
||||
- .github
|
||||
|
||||
```terminal
|
||||
$ rm -rf .travis.yml .github _posts/*
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -129,7 +129,7 @@ Before the deployment begins, checkout the file `_config.yml` and make sure that
|
||||
|
||||
By deploying the site in this way, you're allowed to push the source code directly to the remote.
|
||||
|
||||
> **Note**: If you want to use any third-party Jekyll plugins that not in [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
||||
> **Note**: If you want to use any third-party Jekyll plugins that not on [this list](https://pages.github.com/versions/), stop reading the current approach and go to [*Option 2: Build locally*](#option-2-build-locally).
|
||||
|
||||
**1**. Rename the repository to:
|
||||
|
||||
@@ -167,7 +167,7 @@ it will automatically generates the *Latest Modified Date* and *Categories / Tag
|
||||
|
||||
### Option 2: Build Locally
|
||||
|
||||
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any another plugins that not in the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
||||
For security reasons, GitHub Pages runs on `safe` mode, which means the third-party Jekyll plugins or custom scripts won't work. If you want to use any other plugin that not on the [whitelist](https://pages.github.com/versions/), **you have to generate the site locally rather than on GitHub Pages**.
|
||||
|
||||
**1**. Browse to GitHub website, create a brand new repo named:
|
||||
|
||||
|
||||
@@ -31,20 +31,21 @@ read_categories() {
|
||||
local _category=$(echo "$_yaml" | grep "^category:")
|
||||
|
||||
if [[ ! -z "$_categories" ]]; then
|
||||
echo "$_categories" | sed "s/categories: *//;s/\[//;s/\]//;s/, */,/g;s/\"//g;s/'//g"
|
||||
echo "$_categories" | sed "s/categories: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
|
||||
elif [[ ! -z "_category" ]]; then
|
||||
echo "$_category" | sed "s/category: *//;s/\[//;s/\]//;s/, */,/g;s/\"//g;s/'//g"
|
||||
echo "$_category" | sed "s/category: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
read_tags() {
|
||||
local _yaml=$(_read_yaml $1)
|
||||
echo "$_yaml" | grep "^tags:" | sed "s/tags: *//;s/\[//;s/\]//;s/, */,/g;s/\"//g;s/'//g"
|
||||
echo "$_yaml" | grep "^tags:" | sed "s/tags: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
|
||||
}
|
||||
|
||||
|
||||
init() {
|
||||
|
||||
if [[ -d categories ]]; then
|
||||
rm -rf categories
|
||||
fi
|
||||
@@ -53,39 +54,47 @@ init() {
|
||||
rm -rf tags
|
||||
fi
|
||||
|
||||
if [[ ! -d _posts ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir categories tags
|
||||
}
|
||||
|
||||
|
||||
create_category() {
|
||||
local _name=$1
|
||||
local _filepath="categories/$(echo $_name | sed 's/ /-/g' | awk '{print tolower($0)}').html"
|
||||
if [[ ! -z $1 ]]; then
|
||||
local _name=$1
|
||||
local _filepath="categories/$(echo $_name | sed 's/ /-/g' | awk '{print tolower($0)}').html"
|
||||
|
||||
if [[ ! -f $_filepath ]]; then
|
||||
echo "---" > $_filepath
|
||||
echo "layout: category" >> $_filepath
|
||||
echo "title: $_name" >> $_filepath
|
||||
echo "category: $_name" >> $_filepath
|
||||
echo "---" >> $_filepath
|
||||
if [[ ! -f $_filepath ]]; then
|
||||
echo "---" > $_filepath
|
||||
echo "layout: category" >> $_filepath
|
||||
echo "title: $_name" >> $_filepath
|
||||
echo "category: $_name" >> $_filepath
|
||||
echo "---" >> $_filepath
|
||||
|
||||
((category_count=category_count+1))
|
||||
((category_count=category_count+1))
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
create_tag() {
|
||||
local _name=$1
|
||||
local _filepath="tags/$( echo $_name | sed "s/ /-/g;s/'//g" | awk '{print tolower($0)}' ).html"
|
||||
if [[ ! -z $1 ]]; then
|
||||
local _name=$1
|
||||
local _filepath="tags/$( echo $_name | sed "s/ /-/g;s/'//g" | awk '{print tolower($0)}' ).html"
|
||||
|
||||
if [[ ! -f $_filepath ]]; then
|
||||
if [[ ! -f $_filepath ]]; then
|
||||
|
||||
echo "---" > $_filepath
|
||||
echo "layout: tag" >> $_filepath
|
||||
echo "title: $_name" >> $_filepath
|
||||
echo "tag: $_name" >> $_filepath
|
||||
echo "---" >> $_filepath
|
||||
echo "---" > $_filepath
|
||||
echo "layout: tag" >> $_filepath
|
||||
echo "title: $_name" >> $_filepath
|
||||
echo "tag: $_name" >> $_filepath
|
||||
echo "---" >> $_filepath
|
||||
|
||||
((tag_count=tag_count+1))
|
||||
((tag_count=tag_count+1))
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -97,46 +106,45 @@ create_tag() {
|
||||
# $2 - type specified option
|
||||
#########################################
|
||||
create_pages() {
|
||||
if [[ $1 == '' ]]; then
|
||||
exit 0
|
||||
if [[ ! -z $1 ]]; then
|
||||
# split string to array
|
||||
IFS_BAK=$IFS
|
||||
IFS=','
|
||||
local _string=$1
|
||||
|
||||
case $2 in
|
||||
|
||||
$TYPE_CATEGORY)
|
||||
for i in ${_string#,}; do
|
||||
create_category $i
|
||||
done
|
||||
;;
|
||||
|
||||
$TYPE_TAG)
|
||||
for i in ${_string#,}; do
|
||||
create_tag $i
|
||||
done
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
IFS=$IFS_BAK
|
||||
fi
|
||||
|
||||
# split string to array
|
||||
IFS_BAK=$IFS
|
||||
IFS=','
|
||||
local _string=$1
|
||||
|
||||
case $2 in
|
||||
|
||||
$TYPE_CATEGORY)
|
||||
for i in ${_string#,}; do
|
||||
create_category $i
|
||||
done
|
||||
;;
|
||||
|
||||
$TYPE_TAG)
|
||||
for i in ${_string#,}; do
|
||||
create_tag $i
|
||||
done
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
IFS=$IFS_BAK
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
main() {
|
||||
|
||||
init
|
||||
|
||||
for _file in $(ls "_posts")
|
||||
for _file in $(find "_posts" -type f \( -iname \*.md -o -iname \*.markdown \))
|
||||
do
|
||||
local _path="_posts/$_file"
|
||||
local _categories=$(read_categories "$_path")
|
||||
local _tags=$(read_tags "$_path")
|
||||
local _categories=$(read_categories "$_file")
|
||||
local _tags=$(read_tags "$_file")
|
||||
|
||||
create_pages "$_categories" $TYPE_CATEGORY
|
||||
create_pages "$_tags" $TYPE_TAG
|
||||
|
||||
@@ -19,6 +19,7 @@ OUTPUT_FILE=updates.yml
|
||||
|
||||
|
||||
_init() {
|
||||
|
||||
if [[ ! -d "$OUTPUT_DIR" ]]; then
|
||||
mkdir "$OUTPUT_DIR"
|
||||
fi
|
||||
@@ -27,7 +28,9 @@ _init() {
|
||||
rm -f "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
fi
|
||||
|
||||
touch "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
if [[ ! -d $POST_DIR ]]; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +58,10 @@ _has_changed() {
|
||||
_dump() {
|
||||
local _lasmod="`git log -1 --pretty=%ad --date=iso $2`"
|
||||
|
||||
if [[ ! -f "$OUTPUT_DIR/$OUTPUT_FILE" ]]; then
|
||||
touch "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
fi
|
||||
|
||||
echo "-" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
echo " filename: '$1'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
echo " lastmod: '$_lasmod'" >> "$OUTPUT_DIR/$OUTPUT_FILE"
|
||||
@@ -67,14 +74,12 @@ main() {
|
||||
|
||||
local _count=0
|
||||
|
||||
for _file in $(ls -r "$POST_DIR")
|
||||
for _file in $(find ${POST_DIR} -type f \( -iname \*.md -o -iname \*.markdown \))
|
||||
do
|
||||
_filepath="$POST_DIR/$_file"
|
||||
_filename="${_file%.*}" # jekyll cannot read the extension of a file, so omit it.
|
||||
_filename=${_filename:11} # remove the date
|
||||
_filename=$(basename $_file | sed 's/[0-9]\([0-9]*-\)//g;s/\..*//' ) # remove date and extension
|
||||
|
||||
if _has_changed "$_filepath"; then
|
||||
_dump "$_filename" "$_filepath"
|
||||
if _has_changed "$_file"; then
|
||||
_dump "$_filename" "$_file"
|
||||
((_count=_count+1))
|
||||
fi
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
|
||||
const proxyData = '{"url": "{{ site.google_analytics.pv.proxy_endpoint }}"}';
|
||||
{% include_relative _pv-config.js %}
|
||||
|
||||
{% include_relative _utils/pageviews.js %}
|
||||
|
||||
|
||||
14
assets/js/_pv-config.js
Normal file
14
assets/js/_pv-config.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/*!
|
||||
PV configuration and Javascript conversion.
|
||||
*/
|
||||
|
||||
const proxyEndpoint = "{{ site.google_analytics.pv.proxy_endpoint }}";
|
||||
|
||||
|
||||
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
|
||||
{% assign enabled = true %}
|
||||
{% else %}
|
||||
{% assign enabled = false %}
|
||||
{% endif %}
|
||||
|
||||
const pvCacheEnabled = {{ enabled }};
|
||||
@@ -24,19 +24,13 @@ function countUp(min, max, destId) {
|
||||
|
||||
|
||||
function countPV(path, rows) {
|
||||
/* path permalink looks like: '/posts/post-title/' */
|
||||
var fileName = path.replace(/\/posts\//g, '').replace(/\//g, '.html'); /* e.g. post-title.html */
|
||||
var count = 0;
|
||||
|
||||
var _v2_url = path.replace(/posts\//g, ''); /* the v2.0+ blog permalink: "/post-title/" */
|
||||
|
||||
for (var i = 0; i < rows.length; ++i) {
|
||||
var gaPath = rows[i][0];
|
||||
if (gaPath == path ||
|
||||
gaPath == _v2_url ||
|
||||
gaPath.concat('/') == _v2_url ||
|
||||
gaPath.slice(gaPath.lastIndexOf('/') + 1) === fileName) { /* old permalink record */
|
||||
if (gaPath == path) { /* path format see: site.permalink */
|
||||
count += parseInt(rows[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +89,9 @@ var getInitStatus = (function() {
|
||||
var PvCache = (function() {
|
||||
const KEY_PV = "pv";
|
||||
const KEY_CREATION = "pv_created_date";
|
||||
const KEY_PV_TYPE = "pv_type";
|
||||
const KEY_PV_SRC = "pv_source";
|
||||
|
||||
var PvType = {
|
||||
var Source = {
|
||||
ORIGIN: "origin",
|
||||
PROXY: "proxy"
|
||||
};
|
||||
@@ -116,29 +110,29 @@ var PvCache = (function() {
|
||||
},
|
||||
saveOriginCache: function(pv) {
|
||||
set(KEY_PV, pv);
|
||||
set(KEY_PV_TYPE, PvType.ORIGIN );
|
||||
set(KEY_PV_SRC, Source.ORIGIN );
|
||||
set(KEY_CREATION, new Date().toJSON() );
|
||||
},
|
||||
saveProxyCache: function(pv) {
|
||||
set(KEY_PV, pv);
|
||||
set(KEY_PV_TYPE, PvType.PROXY );
|
||||
set(KEY_PV_SRC, Source.PROXY );
|
||||
set(KEY_CREATION, new Date().toJSON() );
|
||||
},
|
||||
isOriginCache: function() {
|
||||
return get(KEY_PV_TYPE) == PvType.ORIGIN;
|
||||
isFromOrigin: function() {
|
||||
return get(KEY_PV_SRC) == Source.ORIGIN;
|
||||
},
|
||||
isProxyCache: function() {
|
||||
return get(KEY_PV_TYPE) == PvType.PROXY;
|
||||
isFromProxy: function() {
|
||||
return get(KEY_PV_SRC) == Source.PROXY;
|
||||
},
|
||||
isExpired: function() {
|
||||
if (PvCache.isOriginCache() ) {
|
||||
if (PvCache.isFromOrigin() ) {
|
||||
let date = new Date(get(KEY_CREATION));
|
||||
date.setDate(date.getDate() + 1); /* fetch origin-data every day */
|
||||
date.setDate(date.getDate() + 1); /* update origin records every day */
|
||||
return Date.now() >= date.getTime();
|
||||
|
||||
} else if (PvCache.isProxyCache() ) {
|
||||
} else if (PvCache.isFromProxy() ) {
|
||||
let date = new Date(get(KEY_CREATION) );
|
||||
date.setHours(date.getHours() + 1); /* proxy-data is updated every hour */
|
||||
date.setHours(date.getHours() + 1); /* update proxy records per hour */
|
||||
return Date.now() >= date.getTime();
|
||||
}
|
||||
return false;
|
||||
@@ -151,7 +145,7 @@ var PvCache = (function() {
|
||||
},
|
||||
inspectKeys: function() {
|
||||
if (localStorage.getItem(KEY_PV) == null
|
||||
|| localStorage.getItem(KEY_PV_TYPE) == null
|
||||
|| localStorage.getItem(KEY_PV_SRC) == null
|
||||
|| localStorage.getItem(KEY_CREATION) == null) {
|
||||
localStorage.clear();
|
||||
}
|
||||
@@ -161,20 +155,33 @@ var PvCache = (function() {
|
||||
})(); /* PvCache */
|
||||
|
||||
|
||||
function fetchOriginPageviews(pvData) {
|
||||
if (pvData === undefined) {
|
||||
return;
|
||||
function fetchPageviews(fetchOrigin = true, filterOrigin = false) {
|
||||
/* pvCacheEnabled › see: /assets/js/_pv-config.js */
|
||||
if (pvCacheEnabled && fetchOrigin) {
|
||||
fetch('/assets/js/data/pageviews.json')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (filterOrigin) {
|
||||
if (PvCache.newerThan(data)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
displayPageviews(data);
|
||||
PvCache.saveOriginCache(JSON.stringify(data));
|
||||
})
|
||||
.then(() => fetchProxyPageviews());
|
||||
|
||||
} else {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
displayPageviews(pvData);
|
||||
PvCache.saveOriginCache(JSON.stringify(pvData));
|
||||
|
||||
}
|
||||
|
||||
|
||||
function fetchProxyPageviews() {
|
||||
let proxy = JSON.parse(proxyData); /* see file '/assets/data/pv-data.json' */
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: proxy.url,
|
||||
url: proxyEndpoint, /* see: /assets/js/_pv-config.js */
|
||||
dataType: 'jsonp',
|
||||
jsonpCallback: "displayPageviews",
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
@@ -192,41 +199,24 @@ $(function() {
|
||||
if ($('.pageviews').length > 0) {
|
||||
|
||||
PvCache.inspectKeys();
|
||||
|
||||
let cache = PvCache.getData();
|
||||
|
||||
if (cache) {
|
||||
displayPageviews(cache);
|
||||
|
||||
if (PvCache.isExpired()) {
|
||||
if (PvCache.isProxyCache() ) {
|
||||
let originPvData = pageviews ? JSON.parse(pageviews) : undefined;
|
||||
if (originPvData) {
|
||||
if (PvCache.newerThan(originPvData)) {
|
||||
displayPageviews(cache);
|
||||
} else {
|
||||
fetchOriginPageviews(originPvData);
|
||||
}
|
||||
}
|
||||
fetchPageviews(true, PvCache.isFromProxy());
|
||||
|
||||
fetchProxyPageviews();
|
||||
} else {
|
||||
|
||||
} else if (PvCache.isOriginCache() ) {
|
||||
fetchOriginPageviews(originPvData);
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
|
||||
} else { /* still valid */
|
||||
displayPageviews(cache);
|
||||
|
||||
if (PvCache.isOriginCache() ) {
|
||||
fetchProxyPageviews();
|
||||
if (PvCache.isFromOrigin()) {
|
||||
fetchPageviews(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
let originPvData = pageviews ? JSON.parse(pageviews) : undefined;
|
||||
fetchOriginPageviews(originPvData);
|
||||
fetchProxyPageviews();
|
||||
fetchPageviews();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,37 +8,41 @@
|
||||
|
||||
$(function() {
|
||||
|
||||
function timeago(date, isLastmod) {
|
||||
var now = new Date();
|
||||
var past = new Date(date);
|
||||
var seconds = Math.floor((now - past) / 1000);
|
||||
function timeago(iso, isLastmod) {
|
||||
let now = new Date();
|
||||
let past = new Date(iso);
|
||||
|
||||
var year = Math.floor(seconds / 31536000);
|
||||
if (year >= 1) {
|
||||
return year + " year" + (year > 1 ? "s" : "") + " ago";
|
||||
if (past.getFullYear() != now.getFullYear()) {
|
||||
toRefresh -= 1;
|
||||
return past.toLocaleString("en-US", {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric'
|
||||
});
|
||||
}
|
||||
|
||||
var month = Math.floor(seconds / 2592000);
|
||||
if (month >= 1) {
|
||||
return month + " month" + (month > 1 ? "s" : "") + " ago";
|
||||
if (past.getMonth() != now.getMonth()) {
|
||||
toRefresh -= 1;
|
||||
return past.toLocaleString("en-US", {
|
||||
month: 'short',
|
||||
day: 'numeric'
|
||||
});
|
||||
}
|
||||
|
||||
var week = Math.floor(seconds / 604800);
|
||||
if (week >= 1) {
|
||||
return week + " week" + (week > 1 ? "s" : "") + " ago";
|
||||
}
|
||||
let seconds = Math.floor((now - past) / 1000);
|
||||
|
||||
var day = Math.floor(seconds / 86400);
|
||||
let day = Math.floor(seconds / 86400);
|
||||
if (day >= 1) {
|
||||
toRefresh -= 1;
|
||||
return day + " day" + (day > 1 ? "s" : "") + " ago";
|
||||
}
|
||||
|
||||
var hour = Math.floor(seconds / 3600);
|
||||
let hour = Math.floor(seconds / 3600);
|
||||
if (hour >= 1) {
|
||||
return hour + " hour" + (hour > 1 ? "s" : "") + " ago";
|
||||
}
|
||||
|
||||
var minute = Math.floor(seconds / 60);
|
||||
let minute = Math.floor(seconds / 60);
|
||||
if (minute >= 1) {
|
||||
return minute + " minute" + (minute > 1 ? "s" : "") + " ago";
|
||||
}
|
||||
@@ -50,29 +54,30 @@ $(function() {
|
||||
function updateTimeago() {
|
||||
$(".timeago").each(function() {
|
||||
if ($(this).children("i").length > 0) {
|
||||
var basic = $(this).text();
|
||||
var isLastmod = $(this).hasClass('lastmod');
|
||||
var node = $(this).children("i");
|
||||
var date = node.text(); /* ISO Dates: 'YYYY-MM-DDTHH:MM:SSZ' */
|
||||
var date = node.text(); /* ISO Date: 'YYYY-MM-DDTHH:MM:SSZ' */
|
||||
$(this).text(timeago(date, isLastmod));
|
||||
$(this).append(node);
|
||||
}
|
||||
});
|
||||
|
||||
if (vote == 0 && intervalId != undefined) {
|
||||
if (toRefresh == 0 && intervalId != undefined) {
|
||||
clearInterval(intervalId); /* stop interval */
|
||||
}
|
||||
return vote;
|
||||
return toRefresh;
|
||||
}
|
||||
|
||||
|
||||
var vote = $(".timeago").length;
|
||||
if (vote == 0) {
|
||||
var toRefresh = $(".timeago").length;
|
||||
|
||||
if (toRefresh == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateTimeago() > 0) { /* run immediately */
|
||||
vote = $(".timeago").length; /* resume */
|
||||
var intervalId = setInterval(updateTimeago, 60000); /* loop every minutes */
|
||||
if (updateTimeago() > 0) { /* run immediately */
|
||||
var intervalId = setInterval(updateTimeago, 60000); /* run every minute */
|
||||
}
|
||||
|
||||
});
|
||||
@@ -42,19 +42,16 @@ const include = [
|
||||
|
||||
/* The posts of first Home page and recent update list */
|
||||
{% assign post_list = "" | split: "" %}
|
||||
{% assign sum = 0 %}
|
||||
|
||||
{% for post in site.posts %}
|
||||
{% assign post_list = post_list | push: post.url %}
|
||||
{% assign sum = sum | plus: 1 %}
|
||||
{% if sum >= site.paginate %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% for post in site.posts limit: site.paginate %}
|
||||
{% capture post_url %}{{ post.url | relative_url }}{% endcapture %}
|
||||
{% assign post_list = post_list | push: post_url %}
|
||||
{% endfor %}
|
||||
|
||||
{% include update-list.html %}
|
||||
|
||||
{% for item in update_list %}
|
||||
{% assign url = item | split: "::" | last | prepend: "/posts/" | append: "/" %}
|
||||
{% assign url = item | split: "::" | last | url_encode | prepend: "/posts/" | append: "/" | relative_url %}
|
||||
{% assign post_list = post_list | push: url %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -106,6 +103,9 @@ const include = [
|
||||
];
|
||||
|
||||
const exclude = [
|
||||
'/assets/js/data/pv-cache.js',
|
||||
{%- if site.google_analytics.pv.proxy_url and site.google_analytics.pv.enabled -%}
|
||||
'{{ site.google_analytics.pv.proxy_url }}',
|
||||
{%- endif -%}
|
||||
'/assets/js/data/pageviews.json',
|
||||
'/img.shields.io/'
|
||||
];
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
---
|
||||
layout: compress
|
||||
---
|
||||
|
||||
{%- capture pv_data -%}
|
||||
{%- if site.google_analytics.pv.cache and site.google_analytics.pv.enabled -%}
|
||||
{% include_relative _pageviews.json %}
|
||||
{%- endif -%}
|
||||
{%- endcapture -%}
|
||||
|
||||
const pageviews = '{{ pv_data }}';
|
||||
@@ -10,9 +10,8 @@ layout: compress
|
||||
"categories": "{{ post.categories | join: ', '}}",
|
||||
"tags": "{{ post.tags | join: ', ' }}",
|
||||
"date": "{{ post.date }}",
|
||||
{% assign _content = post.content %}
|
||||
{% include no-linenos.html %}
|
||||
"snippet": "{{ _content | strip_html | strip_newlines | remove_chars | escape | truncate: 300 | replace: '\', '\\\\' }}"
|
||||
{% include no-linenos.html content=post.content %}
|
||||
"snippet": "{{ content | strip_html | strip_newlines | remove_chars | escape | truncate: 300 | replace: '\', '\\\\' }}"
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
]
|
||||
|
||||
@@ -114,10 +114,11 @@ jekyll-theme-chirpy/
|
||||
```
|
||||
|
||||
|
||||
你需要将以下文件或目录删除:
|
||||
如备注所述,部分文件或目录需要被删除:
|
||||
|
||||
- .travis.yml
|
||||
- .github
|
||||
```terminal
|
||||
$ rm -rf .travis.yml .github _posts/*
|
||||
```
|
||||
|
||||
|
||||
### 配置文件
|
||||
|
||||
@@ -19,7 +19,7 @@ check_status() {
|
||||
local _change=$(git status . -s)
|
||||
|
||||
if [[ ! -z ${_change} ]]; then
|
||||
echo "Warning: Commit the changes of the changes first:"
|
||||
echo "Warning: Commit the following changes first:"
|
||||
echo "$_change"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user