[English] Medium to Jekyll Installation and Configuration Guide
Medium to Jekyll Installation and Configuration Guide
Start!
1. Go to Template Repo -> 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 branchgh-pages
frommain
” - 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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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:
- Log in to a Medium account with access permissions and go to the Medium Dashboard
- Right-click in a blank area
- Select “Inspect”
- Once the Developer Console appears, select “Application”
- Choose “Cookies” -> “https://medium.com”
- Scroll down to find “
sid
” and “uid
” - 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
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:
1
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
- Ensure your environment has Ruby >= 3.1 installed and in use.
cd ./
bundle install
bundle exec jekyll s
- Go to http://127.0.0.1:4000/ to see the results.
- Press
Ctrl-c
to stop.
Adjustments to the basic website configuration file require re-execution to take effect.
===
本文首次發表於 Medium ➡️ 前往查看