generated from cotes2020/chirpy-starter
-
Notifications
You must be signed in to change notification settings - Fork 3
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
ZhgChgLiBot
committed
Jan 18, 2025
1 parent
3d1d93b
commit 91aea28
Showing
4 changed files
with
337 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
169 changes: 169 additions & 0 deletions
169
_posts/medium-to-jekyll-starter/2025-01-17-zh-CN-medium-to-jekyll.md
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,169 @@ | ||
--- | ||
title: "[简体中文] Medium to Jekyll 安装设定教学" | ||
author: ZhgChgLi | ||
date: 2025-01-17T00:00:00.000+0000 | ||
last_modified_at: 2025-01-17T00:00:00.000+0000 | ||
categories: ["tools"] | ||
tags: [meidum,github,jekyll,ruby] | ||
description: ZMediumToJekyll 安装设定教学 | ||
hidden: true | ||
image: | ||
path: /assets/images/zmediumtomarkdown.jpeg | ||
render_with_liquid: false | ||
--- | ||
|
||
[简体中文](../zh-CN-medium-to-jekyll/) | [正體中文](../zh-TW-medium-to-jekyll/) | [English](../en-medium-to-jekyll/) | ||
|
||
# Start! | ||
[](https://github.com/ZhgChgLi/medium-to-jekyll-starter.github.io) | ||
|
||
## 1. 前往 Template Repo -> [medium-to-jekyll-starter.github.io](https://github.com/ZhgChgLi/medium-to-jekyll-starter.github.io) | ||
|
||
 | ||
|
||
点击右上角「Use this template」->「Create a new repository」 | ||
|
||
## 2. Create a new repository | ||
|
||
 | ||
|
||
- Repository name: 通常为 `帐号或组织名称.github.io`,必须以 `*.github.io` 为结尾。 | ||
- 必须为 `Public` Repo 才能使用 Github Pages | ||
|
||
## 3. Create gh-pages branch if needed | ||
 | ||
|
||
- 在 Repo 主页点击「`main`」分支选单,输入「`gh-pages`」,若无则选择「Create branch `gh-pages` from `main`」 | ||
- 若 `gh-pages` 分支已存在、或建立时出现「Sorry, that branch already exists.」则可跳过此步骤 | ||
|
||
## 4. Enable Github Pages,前往 Settings -> Pages -> Build and deployment | ||
 | ||
|
||
- 选择「`gh-pages`」分支,点击「`Save`」储存设定 | ||
|
||
## 5. 等待所有部署工作完成 | ||
 | ||
|
||
- 🟢 pages build and deployment | ||
- 🟢 Build and Deploy | ||
|
||
## 6. 前往网站查看结果 | ||
> https://`帐号或组织名称.github.io` | ||
 | ||
|
||
成功!🎉🎉🎉 | ||
|
||
# Github Repo (Github Actions) 设定 | ||
## 1. 前往所属 Github Repo 的 Github Actions 页面 -> 点击「ZMediumToMarkdown」-> 点击「ZMediumToMarkdown.yml」 | ||
 | ||
> https://github.com/{ORG}/{REPO_NAME}/blob/main/.github/workflows/ZMediumToMarkdown.yml | ||
## 2. 点击右方编辑按钮 | ||
 | ||
|
||
## 3. 设定 Medium 文章自动同步参数 | ||
 | ||
|
||
```yaml | ||
name: ZMediumToMarkdown | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "10 1 15 * *" # Runs at 01:10(UTC), everyday. | ||
# 设定排程多久自动同步一次 | ||
# ref: https://crontab.guru/ | ||
|
||
jobs: | ||
ZMediumToMarkdown: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ZMediumToMarkdown Automatic Bot | ||
uses: ZhgChgLi/ZMediumToMarkdown@main | ||
with: | ||
command: "--cookie_uid ${{ secrets.MEDIUM_COOKIE_UID }} --cookie_sid ${{ secrets.MEDIUM_COOKIE_SID }} -j zhgchgli_test" | ||
# zhgchgli_test 替换成你的 Meidum 使用者 | ||
# 例如 https://medium.com/@zhgchgli -> zhgchgli | ||
# ref: https://github.com/ZhgChgLi/ZMediumToMarkdown?tab=readme-ov-file#usage | ||
``` | ||
|
||
### 有付费墙文章,需提供有存取权限的 Medium 帐号 Cookies。 (作者本人 or Medium Member) | ||
|
||
#### 取得 Meidum 帐号 Cookies MEDIUM_COOKIE_UID & MEDIUM_COOKIE_SID 步骤: | ||
|
||
 | ||
1. 登入拥有存取权限的 Medium 帐号,进入 [Medium 后台](https://medium.com/me/stats) | ||
2. 在空白处点击右键 | ||
3. 选择「Inspect」 | ||
4. 出现 Developer Console 后选择「Application」 | ||
5. 选择「Cookies」->「https://medium.com」 | ||
6. 往下滚动找到「`sid`」「`uid`」 | ||
7. 点两下复制这两个栏位的值 | ||
|
||
#### 将 Meidum 帐号 Cookies 安全存放在 Github Repo Secrets | ||
##### 1. 前往 Github Repo Settings -> Secrets and variables -> Actions -> New repository secret | ||
 | ||
> https://github.com/{ORG}/{REPO_NAME}/settings/secrets/actions/new | ||
##### 2. New secret - MEDIUM_COOKIE_SID | ||
 | ||
- Name: `MEDIUM_COOKIE_SID` | ||
- Secret: 贴上上一步复制的 Medium 帐号 `sid` 值 | ||
##### 3. New secret - MEDIUM_COOKIE_UID | ||
 | ||
- Name: `MEDIUM_COOKIE_UID` | ||
- Secret: 贴上上一步复制的 Medium 帐号 `uid` 值 | ||
|
||
##### 完成 | ||
帐号无特别登出或遇到问题,Cookies 不会失效。 | ||
|
||
如果在同步中出现以下讯息并且同步的文章不完整: | ||
``` | ||
This post is behind Medium's paywall. You must provide valid Medium Member login cookies to download the full post. | ||
``` | ||
代表 Cookies 已失效,请重新照上述步骤重新设定。 | ||
|
||
## 4. 首次手动同步,Repo -> Github Actions -> 点击「ZMediumToMarkdown」-> 点击「Enable workflow」 | ||
初次执行,我们可以自己手动同步一次检查设定是否正确。 | ||
 | ||
|
||
## 5. 等待同步文章与网站部署工作完成 | ||
 | ||
|
||
等待以下三个 Actions 工作执行完成并且没有错误: | ||
- 🟢 ZMediumToMarkdown | ||
- 🟢 pages build and deployment | ||
- 🟢 Build and Deploy | ||
|
||
## 6. 重整网页查看结果,Enjoy! | ||
|
||
> ⚠️ 请注意!所有档案变更都会触发: | ||
> | ||
> - 🟢 pages build and deployment | ||
> - 🟢 Build and Deploy | ||
> | ||
> 需等待以上两个部署工作完成,网站更改才会生效。 | ||
--- | ||
|
||
# Jekyll 网站设定 | ||
|
||
## 网站基本设定 | ||
- `./_config.yml` | ||
- 分享功能设定:`./_data/share.yml` | ||
- 定义文章作者资讯:`./_data/authors.yml` | ||
|
||
## 左侧 Sidebar 设定 | ||
- `./tabs` | ||
- 底部连结按钮:`./_data/contact.yml` | ||
|
||
## 网站底部及其他文字内容设定 | ||
- `./locales/{Lang}.yml` default is `/locales/en.yml` | ||
|
||
## 本地测试 | ||
1. 确定你的环境有安装并使用 Ruby >= 3.1 版本 | ||
2. `cd ./` | ||
3. `bundle install` | ||
4. `bundle exec jekyll s` | ||
5. Go to [http://127.0.0.1:4000/](http://127.0.0.1:4000/) 查看结果 | ||
6. Press `Ctrl-c` to stop. | ||
|
||
*网站基本设定档案有调整需要重新执行才会生效。 |
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
164 changes: 164 additions & 0 deletions
164
_posts/medium-to-jekyll-starter/2025-01-17-zh-en-medium-to-jekyll.md
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,164 @@ | ||
--- | ||
title: "[English] Medium to Jekyll Installation and Configuration Guide" | ||
author: ZhgChgLi | ||
date: 2025-01-17T00:00:00.000+0000 | ||
last_modified_at: 2025-01-17T00:00:00.000+0000 | ||
categories: ["tools"] | ||
tags: [medium, github, jekyll, ruby] | ||
description: ZMediumToJekyll Installation and Configuration Guide | ||
hidden: true | ||
image: | ||
path: /assets/images/zmediumtomarkdown.jpeg | ||
render_with_liquid: false | ||
--- | ||
|
||
[简体中文](../zh-CN-medium-to-jekyll/) | [正體中文](../zh-TW-medium-to-jekyll/) | [English](../en-medium-to-jekyll/) | ||
|
||
# Start! | ||
[](https://github.com/ZhgChgLi/medium-to-jekyll-starter.github.io) | ||
|
||
## 1. Go to Template Repo -> [medium-to-jekyll-starter.github.io](https://github.com/ZhgChgLi/medium-to-jekyll-starter.github.io) | ||
|
||
 | ||
|
||
Click "Use this template" in the upper right corner -> "Create a new repository" | ||
|
||
## 2. Create a new repository | ||
|
||
 | ||
|
||
- Repository name: Usually `account or organization name.github.io`, must end with `*.github.io`. | ||
- Must be a `Public` Repo to use Github Pages | ||
|
||
## 3. Create gh-pages branch if needed | ||
 | ||
|
||
- On the Repo homepage, click the "`main`" branch dropdown, enter "`gh-pages`", if it does not exist, select "Create branch `gh-pages` from `main`" | ||
- If the `gh-pages` branch already exists, or if you see "Sorry, that branch already exists." when creating, you can skip this step | ||
|
||
## 4. Enable Github Pages, go to Settings -> Pages -> Build and deployment | ||
 | ||
|
||
- Select the "`gh-pages`" branch, click "`Save`" to save the settings | ||
|
||
## 5. Wait for all deployment work to complete | ||
 | ||
|
||
- 🟢 pages build and deployment | ||
- 🟢 Build and Deploy | ||
|
||
## 6. Go to the website to check the results | ||
> https://`account_or_organization_name.github.io` | ||
 | ||
|
||
Success! 🎉🎉🎉 | ||
|
||
# Github Repo (Github Actions) Setup | ||
## 1. Go to the Github Actions page of your Github Repo -> Click on "ZMediumToMarkdown" -> Click on "ZMediumToMarkdown.yml" | ||
 | ||
> https://github.com/{ORG}/{REPO_NAME}/blob/main/.github/workflows/ZMediumToMarkdown.yml | ||
## 2. Click the edit button on the right | ||
 | ||
|
||
## 3. Set up the parameters for automatic synchronization of Medium articles | ||
 | ||
|
||
```yaml | ||
name: ZMediumToMarkdown | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "10 1 15 * *" # Runs at 01:10 (UTC) on the 15th of every month. | ||
# Schedule to automatically sync at specified intervals | ||
# Reference: https://crontab.guru/ | ||
|
||
jobs: | ||
ZMediumToMarkdown: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ZMediumToMarkdown Automatic Bot | ||
uses: ZhgChgLi/ZMediumToMarkdown@main | ||
with: | ||
command: "--cookie_uid ${{ secrets.MEDIUM_COOKIE_UID }} --cookie_sid ${{ secrets.MEDIUM_COOKIE_SID }} -j zhgchgli_test" | ||
# Replace 'zhgchgli_test' with your Medium username | ||
# For example, https://medium.com/@zhgchgli -> zhgchgli | ||
# Reference: https://github.com/ZhgChgLi/ZMediumToMarkdown?tab=readme-ov-file#usage | ||
``` | ||
|
||
### Paywall posts require a Medium account with access permissions and cookies. (Author or Medium Member) | ||
|
||
#### Steps to obtain Medium account cookies MEDIUM_COOKIE_UID & MEDIUM_COOKIE_SID: | ||
|
||
1. Log in to a Medium account with access permissions and go to the [Medium Dashboard](https://medium.com/me/stats) | ||
2. Right-click in a blank area | ||
3. Select "Inspect" | ||
4. Once the Developer Console appears, select "Application" | ||
5. Choose "Cookies" -> "https://medium.com" | ||
6. Scroll down to find "`sid`" and "`uid`" | ||
7. Double-click to copy the values of these two fields | ||
|
||
#### Safely store Medium account cookies in GitHub Repo Secrets | ||
##### 1. Go to GitHub Repo Settings -> Secrets and variables -> Actions -> New repository secret | ||
> https://github.com/{ORG}/{REPO_NAME}/settings/secrets/actions/new | ||
##### 2. New secret - MEDIUM_COOKIE_SID | ||
- Name: `MEDIUM_COOKIE_SID` | ||
- Secret: Paste the `sid` value copied from the previous step | ||
##### 3. New secret - MEDIUM_COOKIE_UID | ||
- Name: `MEDIUM_COOKIE_UID` | ||
- Secret: Paste the `uid` value copied from the previous step | ||
|
||
##### Completion | ||
If there is no special logout or issues, the cookies will not expire. | ||
|
||
If the following message appears during synchronization and the articles are incomplete: | ||
``` | ||
This post is behind Medium's paywall. You must provide valid Medium Member login cookies to download the full post. | ||
``` | ||
It means the cookies have expired; please reset them by following the steps above. | ||
|
||
## 4. First manual synchronization, Repo -> GitHub Actions -> Click "ZMediumToMarkdown" -> Click "Enable workflow" | ||
On the first run, we can manually synchronize once to check if the settings are correct. | ||
|
||
## 5. Wait for the synchronization of articles and website deployment to complete. | ||
 | ||
|
||
Wait for the following three Actions to complete without errors: | ||
- 🟢 ZMediumToMarkdown | ||
- 🟢 pages build and deployment | ||
- 🟢 Build and Deploy | ||
|
||
## 6. Refresh the webpage to see the results, Enjoy! | ||
|
||
> ⚠️ Please note! All file changes will trigger: | ||
> | ||
> - 🟢 pages build and deployment | ||
> - 🟢 Build and Deploy | ||
> | ||
> You need to wait for the above two deployment tasks to complete for the website changes to take effect. | ||
--- | ||
|
||
# Jekyll Website Configuration | ||
|
||
## Basic Website Settings | ||
- `./_config.yml` | ||
- Share feature settings: `./_data/share.yml` | ||
- Define author information for articles: `./_data/authors.yml` | ||
|
||
## Left Sidebar Settings | ||
- `./tabs` | ||
- Bottom link buttons: `./_data/contact.yml` | ||
|
||
## Website Footer and Other Text Content Settings | ||
- `./locales/{Lang}.yml` default is `/locales/en.yml` | ||
|
||
## Local Testing | ||
1. Ensure your environment has Ruby >= 3.1 installed and in use. | ||
2. `cd ./` | ||
3. `bundle install` | ||
4. `bundle exec jekyll s` | ||
5. Go to [http://127.0.0.1:4000/](http://127.0.0.1:4000/) to see the results. | ||
6. Press `Ctrl-c` to stop. | ||
|
||
*Adjustments to the basic website configuration file require re-execution to take effect.* |