This article is written by Yuque
"Yuque" is a "knowledge creation tool" incubated by Ant Financial, an innovative product under the concept of Experience Technology, and has become the standard for over 50,000 Alibaba employees for document writing and knowledge accumulation. The blogger is already a user of Yuque and accidentally discovered that Elog can synchronize Yuque articles to the local. Writing with Yuque allows for real-time rendering, and there’s no need to worry about image hosting. Without further ado, let's start the tutorial.
Migrate Blog Articles to Yuque#
Open the Yuque official website and enter the homepage, click the plus sign in the upper left corner

Next, click Import

Then select markdown format

Finally, in the markdown import configuration, select compressed file after markdown packaging

After the import is complete, the Front-matter of the file may be a bit messy, so it is recommended to manually change it.
Install Elog#
First, you need to globally install @elog/cli using npm/ cnpm / yarn / pnpm
Configure package.json#
Add @elog/cli to package.json
Initialization#
Enter the Hexo root directory and use the command to initialize:
After successful initialization, a elog.config.js configuration file and a .elog.env environment variable configuration file for local debugging will be generated in the root directory.
Configure Elog#
The official documentation provides two configuration methods: yuque (Token method) and yuque-pwd (account and password method).
If you are a Yuque member, it is recommended to choose yuque (Token method), otherwise choose yuque-pwd (account and password method).
Edit your elog.config.js file#
Configure .elog.env file#
To prevent this file from leaking during Git uploads, it is recommended to add .elog.env to .gitignore
Specific configuration depends on your setup method.
Below is the official documentation explanation.
Yuque (Token method)#
Note: According to Yuque's pricing adjustments, this method requires a Yuque premium membership to use; accounts that have previously generated tokens can still use them.
For obtaining key information and configuration process, please refer to Key Information Acquisition page.
| Field | Required | Description | Default Value |
|---|---|---|---|
| token | Yes | Yuque Token | - |
| baseUrl | No | Base URL for Yuque API requests | https://www.yuque.com/api/v2 |
| login | Yes | Personal path/space ID | - |
| repo | Yes | Short name of the Yuque repository, also known as the Yuque knowledge base path | - |
| onlyPublic | No | Whether to only retrieve public articles | false |
| onlyPublished | No | Whether to only retrieve published articles | false |
| limit | No | Document download concurrency | 3 |
baseUrl is the request path for the Yuque API.
When the knowledge base type is a personal knowledge base, no configuration is needed.
When the knowledge base type is a team knowledge base, baseUrl=https://spaceid.yuque.com/api/v2, login=spaceid, repo=the Yuque knowledge base path in the space.
Yuque (Account and Password method)#
This method does not require a Yuque membership.
Note: Using this method in non-domestic CI/CD environments, such as GitHub Workflow, will result in a large number of US IPs appearing in the Yuque backend login devices. It is currently unclear whether Yuque will have security restrictions, so please use it with caution. It is recommended to use it during local synchronization.
For obtaining key information and configuration process, please refer to Key Information Acquisition page.
| Field | Required | Description | Default Value |
|---|---|---|---|
| username | Yes | Yuque account, usually a phone number | - |
| password | Yes | Yuque password, can be bound in settings | |
| host | No | Yuque domain/team domain | https://www.yuque.com |
| login | Yes | Personal path/space ID | - |
| repo | Yes | Short name of the Yuque repository, also known as the Yuque knowledge base path | - |
| linebreak | No | Whether to maintain Yuque's line breaks | false |
| onlyPublic | No | Whether to only retrieve public articles | false |
| onlyPublished | No | Whether to only retrieve published articles | false |
| limit | No | Document download concurrency | 3 |
host is the Yuque domain.
When the knowledge base type is a personal knowledge base, no configuration is needed.
When the knowledge base type is a team knowledge base, host=https://spaceid.yuque.com.
Start Synchronization#
After configuration is complete, execute the local synchronization command in the root directory:
Automation Process#
Yuque + webhooks + serverless API + GitHub Actions + GitHub Pages Continuous Integration
Here we quote the content from the official documentation.
#
GitHub Actions#
- Configure the required environment variables in the Secrets and variables - Actions - Secrets section of the repository's Settings
| GITHUBTOKEN | Your GitHub Token |
|---|---|
| YUQUE_REPO | Your Yuque knowledge base path |
| YUQUE_LOGIN | Your Yuque account name (path) |
| YUQUE_USERNAME | Your phone number |
| YUQUE_PASSWORD | Your Yuque password |
If you are using Yuque (Token method), you can replace YUQUE_USERNAME and YUQUE_PASSWORD with YUQUE_TOKEN.
- Create a file named .github/workflows/Deploy Yuque-Hexo Public To Pages in the root directory and configure it according to the following process
Accessing the serverless API can trigger action deployment.
Serverless API#
For convenience, here is a free public Serverless API deployed on Vercel.
Just fill it into the Yuque Webhooks.
Yuque users without a membership can manually call this API to trigger GitHub Actions for automated building & deployment.
Yuque Webhooks#
In the Yuque knowledge base - More settings - Message push, you can configure Yuque webhooks by filling in an API link that supports POST requests (here taking the serverless API as an example). When the document is updated, Yuque will call this API for pushing.
Unfortunately, Yuque has made webhooks a paid feature.
Yuque users without a membership can manually call the API to trigger GitHub Actions for automated building & deployment.
After the knowledge base is configured with the "automatic publishing" feature, document update/publish operations will not send webhooks.
