How to Configure This Website Template (Setup Guide)
1 Introduction
This is an academic personal website template built with Quarto, designed to help researchers quickly set up a personal website to share notes and blog posts. It has the following features:
- Easy to Get Started: Just follow this tutorial and use modern AI tools for troubleshooting. No prior knowledge is required to easily complete website deployment.
- Academic-Friendly: Supports LaTeX-style mathematical formulas, formula citations, and bibliography management, suitable for publishing academic content.
- Lightweight and Clean: Primarily uses Quarto’s native features, minimizing custom CSS/HTML for easier understanding and secondary development.
- AI Auto-Translation: Includes a built-in Python script that utilizes the DeepSeek API to achieve automatic synchronization of Chinese and English content.
- Automated Deployment: Integrated with GitHub Actions for automatic, free building and publishing. No manual operations or personal server configuration is needed.
- Responsive Design: Clean and aesthetically pleasing interface, adapted for both desktop and mobile devices.
1.1 Project Folder Structure and Function Explanation
Before starting the configuration, we need to understand the project’s folder structure and the functions of each part to facilitate comprehension of subsequent operations.
username.github.io/ # Your personal website project root directory
├─ _quarto.yml # Quarto website global configuration file
├─ index.qmd # Website homepage (source language version. Default is Chinese; the translation script automatically generates the other language version, see details later)
├─ requirements.txt # Python dependency list
├─ README.md # Repository documentation
├─ references.bib # Global bibliography database
├─ .gitignore # Git ignore file list
├─ .github/ # GitHub configuration folder
│ └─ workflows/
│ └─ publish.yml # GitHub Actions automation workflow, see details later
├─ content/ # Main content folder, where you usually need to edit
│ ├─ en/ # English content
│ │ ├─ _metadata.yml # English folder metadata
│ │ ├─ index.qmd # English homepage (if the source language is Chinese, this file is automatically generated by the translation script)
│ │ ├─ cv.qmd # English CV
│ │ ├─ blog/ # English blog
│ │ ├─ notes/ # English notes
│ │ │ ├─ _metadata.yml # Notes folder metadata
│ │ │ └─ ...
│ │ └─ publications/ # English publications
│ └─ zh/ # Chinese content
│ ├─ _metadata.yml # Chinese folder metadata
│ ├─ cv.qmd # Chinese CV
│ ├─ blog/ # Chinese blog
│ ├─ notes/ # Chinese notes
│ └─ publications/ # Chinese publications
├─ assets/ # Static resources
│ ├─ css/
│ │ └─ custom.css # Custom styles
│ ├─ images/
│ │ └─ avatar.jpg # Avatar and other images
│ └─ html/
│ ├─ footer.html # Custom footer
│ └─ include_lang_switch.html # Language switcher
├─ scripts/ # Automation scripts folder
│ ├─ README.md # Script documentation
│ ├─ sync_deepseek.py # Auto-translation script
│ └─ tex2qmd.py # LaTeX to Quarto conversion script
└─ _site/ # Generated static website (auto-generated, do not edit manually)
1.1.1 Supplementary Notes
Root directory
index.qmd: The source file for the website homepage. It is written in Chinese by default (lang: zh). The translation script will automatically generate the English version tocontent/en/index.qmd. If you prefer writing in English, you can changelangtoen, and the script will generate the Chinese version tocontent/zh/index.qmd._metadata.yml: Can be placed in any content subfolder (e.g.,blog/,notes/) to define default metadata for all documents within that folder. See the later section “Configuration Hierarchy and Priority” for details._site/: The static website generated by Quarto after building. Do not edit manually.
2 Preparation
This tutorial assumes you already have a GitHub account. If you don’t, please visit the GitHub website to register for one. GitHub is the world’s largest code hosting platform, supporting version control, collaborative development, and automated deployment. You will use it to store your website source code, manage history, and implement automated building and publishing via GitHub Actions.
If you are a student from a non-computer science background, you might find the following tools unfamiliar. Don’t worry, these tools are well worth learning, and the time invested will not be wasted.
Suggestion: When you encounter unfamiliar terms (e.g., “git commit”, “pull request”), ask an AI directly (like ChatGPT or DeepSeek). For example: “I am a non-computer science student. Please explain in simple terms what Git is and how to use it in VS Code?”
Feel free to ask questions by creating an Issue in the comments section. This can also help others who come later.
2.1 Core Tools
This project requires downloading and installing the following tools:
VS Code: A powerful text editor. We will use it to write code, write articles, manage the project, and operate Git.
Quarto CLI: The engine that converts your Markdown articles into web pages.
Git: A version control tool used to synchronize changes to GitHub.
Python (Optional): Used to run the translation script locally. Please check “Add Python to PATH” during installation.
Please search for the installation and configuration of the relevant tools yourself; they will not be detailed here.
2.1.1 About VS Code
VS Code is essentially a text editor, but it has a rich plugin ecosystem—these plugins enable VS Code to “understand” various languages (syntax highlighting, error checking, auto-completion) or “transform” into various tools (Git client, Quarto editor, etc.). It is called an “Integrated Development Environment” (IDE).
However, VS Code and its plugins are only responsible for editing. The execution of code is handled by external tools installed on your computer (e.g., Python interpreter, TeX compiler).
For example: To write Python in VS Code, you need to install both:
- Python plugin: Makes the editor recognize
.pyfiles and provides intelligent suggestions. - Python interpreter: The program that actually runs the code.
This tutorial focuses on Quarto website configuration. The detailed usage of the aforementioned tools is too lengthy to be covered here. If needed, it is recommended to search on your own or ask an AI. Considering the importance of Git for this project’s configuration and that students from non-computer science backgrounds might be less familiar with it, the following section will briefly introduce its value and learning suggestions.
2.1.2 About Git and GitHub: A Skill Worth Investing In
The main point here is to emphasize: Git is a skill very much worth learning.
What is the relationship between Git and GitHub?
- Git: A version control tool installed on your computer, responsible for recording every change history of files.
- GitHub: A cloud-based code hosting platform that can synchronize your local Git repository online, enabling backup, collaboration, and automated deployment.
Simply put: Git manages local history, GitHub handles cloud synchronization. Used together, your code has a complete version history and cloud backup.
Why is it worth learning?
- Version History: Each “commit” saves a snapshot, allowing you to revert to any past version at any time.
- Cloud Backup: After pushing to GitHub, your code won’t be lost even if your computer breaks.
- Multi-device Synchronization: Push from your lab computer, pull at your dorm, and continue seamlessly.
- Collaboration and Automation: GitHub supports multi-person collaboration and automated builds (like the automatic translation and deployment in this project).
Good News: VS Code Makes Git Simple
You do not need to remember complex command lines. VS Code has a built-in graphical Git interface—the “Source Control” panel in the left sidebar can handle 90% of daily operations: viewing changes, committing, pushing, pulling, all achievable with just a few clicks.
Learning Suggestions:
- When you encounter an unfamiliar concept, ask an AI directly: “Please explain in simple terms what a Git commit means?”
- Search for tutorial videos or articles to learn the basic operational workflow.
Git and GitHub are fundamental infrastructure in modern research. Whether you will be writing code, performing data analysis, or managing experimental records in the future, this skill will benefit you for life. Investing a few hours to learn it yields long-term efficiency gains. VS Code is also worth the investment, as it can greatly enhance your writing and programming efficiency.
2.2 Recommended Extensions
Open the Extensions store on the left sidebar of VS Code, search for and install:
- Quarto: Provides syntax highlighting and live preview for
.qmdfiles (the file format for the web articles in this project). Essential for this project. - GitHub Copilot (Recommended): An AI programming assistant, available for free with educational verification. Can significantly improve efficiency in writing code and documentation.
2.3 Verify Installation
After ensuring the above tools are installed, please verify that Quarto is correctly installed. Open VS Code, select Terminal -> New Terminal from the top menu bar, enter the following command, and press Enter:
quarto --versionIf a version number (e.g., 1.8.xx) is displayed, the installation is successful.
3 Configuration Steps
3.1 Fork the Project
First, you need to Fork this project template to your own GitHub account:
- Open the GitHub page of this project.
- Click the Fork button in the top right corner.
- Important: Change the repository name to
your-username.github.io(e.g.,zhangsan.github.io). This is necessary to enable the default GitHub Pages domain. - (Recommended) Uncheck “Copy the main branch only” to copy the
gh-pagesbranch (if it exists in the template repository). - Click Create fork.
After forking, you will have your own independent copy that you can freely modify and configure.
Clone to Local: Open a terminal and run the following command (replace your-username with your GitHub username):
git clone https://github.com/your-username/your-username.github.io.git
cd your-username.github.ioAfter cloning, open the folder with VS Code to start editing.
3.2 Configure AI Translation (DeepSeek)
This template uses the DeepSeek API for automatic translation. You need to configure an API Key to use this feature.
- Obtain a Key: Go to the DeepSeek Platform, register, and apply for an API Key (format:
sk-xxxxx). New users typically have free credits. - Configure GitHub Secrets:
- Go to your GitHub repository page.
- Click Settings -> Secrets and variables -> Actions.
- Click New repository secret.
- Name:
DEEPSEEK_API_KEY - Secret: Paste your Key.
3.3 Key Initialization Steps
Before performing the first push, you must complete the following initialization configuration. Otherwise, the automation scripts may fail with errors.
Important Note: All the following commands must be run in the project’s root directory. If you have opened this project’s folder in VS Code, simply open the terminal (Terminal -> New Terminal) – it defaults to the project root directory.
3.3.1 Ensure Complete Directory Structure
Git has a characteristic: it does not track empty folders.
This means that if you create a new folder but haven’t placed any files in it, or if you delete all files from a folder, that folder will disappear when pushed to GitHub.
This can cause automation scripts (like the translation script) to fail with errors when running in the cloud because they cannot find the expected directory structure (e.g., content/en).
If you forked this project directly without deleting any files, then this should be fine, and you can skip this step.
Solution: Please ensure that the content/zh and content/en directories in this project, along with their subdirectories (e.g., blog, notes), contain at least one file. If they are empty, manually create an empty file named .gitkeep as a placeholder. You can use command-line operations:
# macOS / Linux / Git Bash:
touch content/en/.gitkeep
# Windows PowerShell:
New-Item -Path content/en/.gitkeep -ItemType File -Force3.3.2 Initialize the Publishing Branch (gh-pages)
The project’s automation scripts will push the compiled HTML webpage files to the gh-pages branch. If this branch does not exist, the first deployment will fail.
Please run the following commands in the terminal to check and create it:
# 1. Check if the gh-pages branch already exists
git branch -a
# If the output already includes "remotes/origin/gh-pages", you can skip the following steps.
# Otherwise, continue executing the commands below to create the branch:
# 2. Create an empty orphan branch
git checkout --orphan gh-pages
# 3. Clear the staging area (the VS Code file list will become empty at this point—don't panic)
git rm -rf .
# 4. Create an empty commit
git commit --allow-empty -m "Initial gh-pages"
# 5. Push to remote
git push origin gh-pages
# 6. Switch back to the main branch
git checkout mainTip: After executing step 3, the file list on the left side of VS Code will momentarily clear—this is normal. You have simply switched to an empty branch. After executing step 6 to switch back to
main, all files will be restored.
3.3.3 Enable GitHub Permissions
New repositories have read-only permissions by default, which prevents writing back translation results (i.e., GitHub Actions cannot push the translated English files to your repository).
- Go to your project’s GitHub repository page -> Settings -> Actions -> General.
- Scroll to the bottom to Workflow permissions.
- Select Read and write permissions.
- Click Save.
3.3.4 Configure the GitHub Pages Branch
To ensure the website displays correctly, you need to tell GitHub which branch to deploy the pages from.
- Open your project’s GitHub repository page -> Settings -> Pages.
- Under Build and deployment:
- Source: Select
Deploy from a branch. - Branch: Select the
gh-pagesbranch, keeping the folder as/ (root).
- Source: Select
- Click Save.
After configuration, wait a few minutes, and your website will be accessible at https://your-username.github.io! 🎉
Note: If the website does not display properly, you can check the deployment status under the Actions tab in your GitHub repository. Click on the most recent run record. If there is a red cross, click into it to view the specific error message and troubleshoot accordingly.
3.4 Configure the Comment System Giscus (Optional)
This template integrates the Giscus comment system. If you do not need comment functionality, please disable it following the tutorial below and skip this step.
How to completely disable comments? Open the
_quarto.ymlfile, find thecommentssection, and delete or comment out that part of the code.
To configure comments, follow these steps:
- Enable Discussions:
- Go to your project’s GitHub repository page -> Settings -> General.
- Scroll down to the Features section.
- Check the box for Discussions.
- Install the Giscus App:
- Visit Giscus App.
- Click Install and authorize it for this repository.
- Obtain Configuration Information:
- Visit giscus.app.
- Enter your repository address (e.g.,
username/username.github.io). - Under Discussion Category, select General.
- Scroll to the bottom, where you will see the generated configuration code.
- Update the Configuration File:
- Open the
_quarto.ymlfile in the project root directory. - Find the
comments->giscussection. - Fill in the
data-repo-idanddata-category-idyou obtained in the previous step into the corresponding positions:
comments: giscus: repo: username/username.github.io # Your repository name repo-id: R_kgDO... # Fill in data-repo-id category: General category-id: DIC_kwDO... # Fill in data-category-id - Open the
- Personalization:
- If you want to disable comments on certain pages (e.g., the homepage), simply add
comments: falseto the YAML frontmatter of that page.
- If you want to disable comments on certain pages (e.g., the homepage), simply add
3.5 Personalization
You need to modify the following files to change the information on this website to your own:
3.5.1 Modify Basic Information (_quarto.yml)
Open the _quarto.yml file in the root directory and modify the website title, description, and URL:
website:
title: "Your Name" # Title displayed in the top-left corner of the website
site-url: "https://yourusername.github.io" # Your website address
description: "Your personal introduction"3.5.2 Modify the Homepage (index.qmd)
Open index.qmd in the root directory. This is your website’s landing page. Modify the title, avatar path, and contact information:
---
title: "Your Name"
lang: zh # Source language: zh for Chinese, en for English
image: assets/images/avatar.jpg # Replace with your avatar
about:
template: trestles # Template style, options: jolla, trestles, solana, marquee, broadside
links:
- icon: github
text: GitHub
href: https://github.com/yourusername
- icon: envelope
text: Email
href: mailto:youremail@example.com
---About the lang field:
lang: zh(default): Indicates you are writing this file in Chinese. The translation script will automatically generate an English version atcontent/en/index.qmd.lang: en: If you want to write the homepage in English, changelangtoen. The script will automatically generate a Chinese version atcontent/zh/index.qmd.
Note: This template defaults to
lang: zh, socontent/en/index.qmdis auto-generated. If you want to switch to writing the homepage in English (lang: en), it is recommended to first deletecontent/en/index.qmdto avoid confusion.
4 Advanced Principles
If you are interested in the principles behind the website or want to perform deep customization, please read the official documentation. This chapter provides some targeted explanations; reading it alongside the project directory structure is recommended.
4.1 How Does the Automatic Translation Scheme Work?
Traditional bilingual websites often require complex i18n configuration or maintaining two completely independent sets of code. This template implements automated mirroring through a Python script (scripts/sync_deepseek.py):
- Mirror Structure: The
.qmdfiles incontent/zhandcontent/encorrespond one-to-one and are automatically translated. Only.qmdfiles participate in synchronization; other files (such as images, PDFs,_metadata.ymlconfiguration files, etc.) are not processed.- Exception: The homepage in the language root directory (
content/zh/index.qmdorcontent/en/index.qmd) also does not participate in synchronization because it is unidirectionally generated from the rootindex.qmdbased on thelangfield.
Note: The script does not actively create empty folders. It only creates corresponding translated files and folder structures in the target language folder (e.g.,
content/en/blog) when.qmdfiles exist in the source language folder (e.g.,content/zh/blog). - Exception: The homepage in the language root directory (
- Automatic Completion:
- When you write
content/zh/blog/post1.qmd, the script automatically generates the correspondingcontent/en/blog/post1.qmd. - And vice versa.
- When you write
- Script Markers: Files automatically generated by the script will have an
<!-- Auto-generated ... -->marker at the end of their code, which is part of the implementation of the automated workflow. - Automatic Translation: You only need to focus on writing in one language; the content in the other language is automatically generated and filled by AI.
- Independence and Unification: Although the content is auto-generated, the generated files are independent. If you are not satisfied with the AI’s translation, you can directly modify the generated file, and the script will respect your changes (unless you delete it).
This design makes website maintenance extremely simple: Write a bilingual website as if you were writing a single-language blog.
4.1.1 How Does the Script Know Which Files Need Translation?
You might wonder how the script knows which file I modified. It determines this through the following logic:
- File Does Not Exist: If there is no corresponding file in
content/en, it means it’s a new article, translate it. - Manual File Protection: If the target file exists, the script first checks for the
<!-- Auto-generated ... -->marker. No marker = a manually created/maintained file. The script will skip it to prevent overwriting your hard work. - Hash Verification: For files with the marker (i.e., those generated by the script), the script calculates the content Hash of the source file and compares it with the Hash recorded in the target file. If they don’t match, it means the source file has been updated, re-translate it. If the target file has no Hash record, it will also be re-translated.
4.1.2 Warning: How to Protect Your Modifications?
Scenario: You modified the English version (corrected an AI error), and later updated the Chinese version.
- Case A (Dangerous): You only modified the English body text but kept the
<!-- Auto-generated ... -->marker at the end of the file.- Result: When the source file content changes (Hash mismatch), the script will think it needs updating and forcefully overwrite it. Your English modifications will be lost!
- Case B (Safe): When you modified the English body text, you deleted the auto-generated marker at the end of the file.
- Result: The script cannot detect the marker, considers this a “manually maintained file,” and thus skips translation. Your modifications are preserved.
Note: Once you decide to manually intervene and modify a translation draft, be sure to delete the auto-generated marker at the end of the file immediately! The automated translation synchronization for this document stops here, and you can manually maintain the bilingual version from now on.
4.2 How Listing Pages Work
The list pages for “Blog,” “Notes,” and “Papers” on the homepage of this template are all automatically generated using Quarto’s Listing feature. You don’t need to manually maintain article lists; you just need to configure the index.qmd for the corresponding folders.
4.2.1 How to Create a New Listing Page?
Suppose you want to create a new section called “Projects.” The steps are as follows:
- Create a Folder: Create a new folder named
projectsundercontent/zh/. - Create an Index File: Create
index.qmdinside it and write the following configuration:
---
title: "My Projects"
listing:
contents: "*.qmd" # Grabs all .qmd files in the current directory
sort: "date desc" # Sorts in descending order by date
type: default # Display style: default (list), grid (grid), table (table)
categories: true # Show category tags
sort-ui: true # Show sort buttons
filter-ui: true # Show search box
page-layout: full
---
Here are all my projects.- Add Content: Create specific project introduction files (e.g.,
project-a.qmd) under theprojectsfolder, and they will automatically appear in the list.
4.2.2 Common Listing Styles (type)
- default: The classic blog list view, showing thumbnails, titles, summaries, and metadata. Suitable for blogs.
- grid: A visually appealing card grid view. Suitable for showcasing portfolios or image-heavy content.
- table: A compact table view. Suitable for displaying large lists of papers or data.
You can change the type field in index.qmd at any time to switch styles.
4.3 Configuration Hierarchy and Priority
A Quarto website is like a simply furnished house. Although the default style is already quite minimalist and aesthetically pleasing, we all desire more options: for example, changing the layout, display options, or styles of one or several web pages. These needs can be achieved through YAML (.yml) configuration files.
4.3.1 What is a YAML (.yml) File?
In this project, you will frequently see files with the .yml suffix, such as _quarto.yml and _metadata.yml. These are configuration files in YAML format.
YAML (YAML Ain’t Markup Language) is a format specifically designed for writing configuration files. Its hallmark is being extremely readable—writing it is like writing an outline, using indentation to represent hierarchical relationships.
About Filenames: YAML itself is just a data format; filenames can be arbitrary (e.g.,
config.yml,settings.yaml). However, Quarto specifies particular filenames:_quarto.ymlis for global configuration, and_metadata.ymlis for directory-level configuration. Only by using these conventional names will Quarto automatically recognize and apply the configurations.
Core Syntax Rules:
- Indentation Indicates Hierarchy: Just like in Python, indentation is crucial.
- Space After Colon:
key: valueis the standard format; a space must follow the colon.
Special Note: YAML at the Document Head (Front Matter)
Besides standalone .yml configuration files, you’ll notice that each .qmd document begins with a section wrapped by three dashes ---. This is also YAML, called Front Matter, specifically used to describe the properties of that article (such as title, author, date, tags, etc.). The syntax for both types of YAML is the same. The difference between YAML (.yml) files and Front Matter is that the former are standalone configuration files, while the latter is embedded within the document; the former does not need to be wrapped in ---.
Quarto’s configuration system is very flexible and follows a “Cascading” principle. Understanding this is crucial for customizing the website.
Quarto supports three levels of configuration files, each with a different scope and priority. They are:
4.3.2 1. Global Configuration (_quarto.yml)
- Location: Project root directory.
- Scope: Entire website.
- Purpose: Defines the website’s theme, navigation bar, language, and default settings for all pages.
- Example: Setting
author: "Perry"here makes Perry the default author for all articles across the entire site.
4.3.3 2. Directory-Level Configuration (_metadata.yml)
- Location: Any subfolder (e.g.,
content/zh/blog/). - Scope: All documents within that folder and its subfolders.
- Purpose: Customizes styles for a specific section, overriding global settings or adding new properties.
- Example: If lightbox effects are not enabled globally, but you want images in the blog section to be clickable for enlargement, set
lightbox: trueinblog/_metadata.yml.
4.3.4 3. Document-Level Configuration (YAML Front Matter)
- Location: Top of a specific
.qmdfile (between---). - Scope: Only the current document.
- Purpose: Defines article-specific properties, such as title, publication date, tags, or overrides higher-level settings.
- Example: If a blog post is a reprint, write
author: "Guest"in the header of that file.
4.3.5 Priority Rule: Proximity Principle
When conflicts arise between configurations at multiple levels, the rule is simple: the closer to the document, the higher the priority.
4.3.5.1 About Nested Folders
If your directory structure has multiple nested layers (e.g., content/zh/notes/math/), each layer can have its own _metadata.yml. Configuration follows an “Inheritance and Override” mechanism:
- Inheritance: Subfolders automatically inherit configurations from parent folders. For example, documents under
math/will automatically apply general settings fromnotes/_metadata.yml. - Override: If a property is redefined in a subfolder, it overrides the same property in the parent folder. For example, you can disable the table of contents specifically for math notes in
math/_metadata.yml.
Final Priority Chain (from highest to lowest): **Document-Level (YAML) > Document’s Folder (_metadata.yml) > Parent Folder (_metadata.yml) > Global (_quarto.yml)**
4.3.5.2 Example (Hypothetical Scenario)
The following is a hypothetical example to illustrate how configuration priority works (not the actual configuration of this template):
_quarto.yml(Global):author: "Site Owner" toc: false # Disable table of contents globally by defaultblog/_metadata.yml(Directory):# No author specified, inherits global toc: true # Enable table of contents for the blog section (overrides global) lightbox: true # Enable click-to-enlarge for imagesblog/post-1.qmd(Document):title: "My First Blog Post" # No author specified, inherits global -> "Site Owner" # No toc specified, inherits from parent -> trueblog/guest-post.qmd(Document):title: "Guest Post" author: "Guest Contributor" # <--- Overrides global! toc: false # <--- Overrides directory! (Disable TOC for this post)
Final Result:
- Post 1: Author is “Site Owner”, table of contents is enabled, lightbox effect is enabled.
- Guest Post: Author is “Guest Contributor”, table of contents is disabled, lightbox effect is enabled.
5 Core Concepts and Writing
After configuration, this is the part you will use most frequently in daily work.
5.1 What is a .qmd File?
.qmd (Quarto Markdown) is the core file format used by this website.
Why use it?
- Simple and Easy to Learn: It is based on Markdown, a minimalist markup language. You don’t need to adjust formatting like in Word; you can write well-structured articles using simple symbols (e.g.,
#for headings). - Powerful: It natively supports LaTeX mathematical formulas (e.g.,
$E=mc^2$) and code blocks, making it ideal for academic writing and data presentation. - Automatic Web Conversion: Your written text is automatically rendered into beautiful HTML web pages.
Quick Start Markdown Example:
# This is a Level 1 Heading
## This is a Level 2 Heading
This is a paragraph of plain text. You can make it **bold** or *italic*.
- This is a list item
- Supports math formulas: $f(x) = \int x dx$
- Supports inserting images: ``5.2 Formula Referencing
Quarto supports numbering and referencing mathematical formulas, making it very suitable for academic writing.
Defining a Numbered Formula:
$$
E = mc^2
$$ {#eq-einstein}Referencing a Formula:
According to Einstein's mass-energy equation @eq-einstein, we can conclude...After rendering, the formula will be automatically numbered (e.g., “(1)”), and the reference will appear as a clickable link (e.g., “Equation 1”).
Tip: Formula labels must start with
#eq-, followed by a custom identifier (e.g.,einstein).
5.3 Literature Citation
This template has already configured the literature citation management function. You only need to:
Add Literature Entries: Add BibTeX format literature entries to the
references.bibfile in the project root directory. For example:@article{Shannon1948, author = {Claude E. Shannon}, title = {A Mathematical Theory of Communication}, journal = {Bell System Technical Journal}, year = {1948} }Cite in the Main Text: Use the
@symbol followed by the literature’s key for citation.Information theory was founded by Shannon [@Shannon1948]. As pointed out by @Shannon1948...[@Shannon1948]renders as: (Shannon 1948)@Shannon1948renders as: Shannon (1948)
Bibliography List: Quarto will automatically generate a bibliography list at the end of the article, no additional configuration is needed. If you want to customize the location of the bibliography (e.g., place it in the middle of the article or under a specific section), you can add the following at the desired location:
## References ::: {#refs} :::
Tip:
- You can use tools like Google Scholar, Zotero, etc., to export BibTeX format literature entries and directly paste them into
references.bib.- When typing
@in VS Code, the Quarto extension will automatically pop up the literature list fromreferences.bibfor you to choose from.
5.4 Publishing Workflow
After writing the article, you can publish it in just three steps:
Create Article: Create a new
.qmdfile in the corresponding subdirectory (e.g.,blog/,notes/) undercontent/zh/orcontent/en/. Write the content in your preferred language (Chinese or English).Commit Changes: You can choose either of the following methods.
Method A: Using VS Code Git (Recommended)
In the VS Code Source Control panel on the left, enter a commit message, click “Commit”, and then click “Sync Changes”.
Note: This method does not run translation locally. Translation will be automatically completed in the cloud after pushing to GitHub.
Method B: Using Command Line
If you are accustomed to using the terminal, you can run standard Git commands:
git add . git commit -m "Commit message" git pushWait for Deployment: After pushing, GitHub Actions will automatically complete translation, building, and publishing. Refresh the website after a few minutes to see the updates.
5.4.1 Local Translation (Optional)
If you wish to preview the translation results locally instead of waiting for automatic cloud translation, you can follow the steps below.
The following commands are all run in the VS Code terminal (Terminal -> New Terminal). Ensure the current directory is the project root.
Step 1: Install Dependencies (Only needs to be done once)
pip install -r requirements.txtStep 2: Set Environment Variables
Windows PowerShell:
$env:DEEPSEEK_API_KEY = "sk-your-key"macOS / Linux:
export DEEPSEEK_API_KEY="sk-your-key"Step 3: Run the Translation Script
python scripts/sync_deepseek.pyNote: Environment variables become invalid after the terminal is closed and need to be set again next time.
5.5 Automated Workflow
After you push your code, GitHub Actions will automatically take over the subsequent tasks:
- Detect Changes: Identifies which
.qmdfiles you have added or modified. - AI Translation:
- If you wrote in Chinese, it will automatically translate it to English.
- If you wrote in English, it will automatically translate it to Chinese.
- The translation results will be automatically committed back to your repository (you will see a new commit from
DeepSeek Bot).
- Build Website: Runs
quarto renderto generate static web pages. - Publish Online: Pushes the web pages to the
gh-pagesbranch. Your website will be updated within a few minutes.
You can view the real-time logs of the entire process on the Actions tab of your GitHub repository.
5.6 Local Preview
Run the following command in the VS Code terminal to preview the website locally in real-time:
quarto preview --render htmlThis will start a local server, and your browser will automatically open the preview page. After you modify and save a file, the page will refresh automatically.
6 FAQ
General Troubleshooting Method: When encountering deployment issues, the first step is to check the run logs on the Actions tab of your GitHub repository. Click on the most recent run record; a red cross indicates failure. Click into it to see specific error messages. If you encounter an error you don’t understand, you can copy the error message and ask an AI to help you analyze it.
6.1 Why isn’t my translation taking effect?
- Check the GitHub Actions logs: On your repository page, click “Actions” and view the details of the most recent run.
- Check the API Key: Ensure you have correctly configured
DEEPSEEK_API_KEYin Secrets and that the key still has a balance. - Local Debugging: If you are running the script locally and the translation is not taking effect, make sure the environment variable is set.
6.2 Getting a 404 error after deployment?
Please check the settings in Settings -> Pages. Ensure the Source branch is set to gh-pages, not main.
6.3 What if I only want to use a single language (e.g., only Chinese) and don’t want the bilingual feature?
This template is designed flexibly and can be switched to single-language mode.
Steps:
- Disable the translation feature:
- Go to your GitHub repository -> Settings -> Secrets and variables -> Actions, and delete
DEEPSEEK_API_KEY. - When the script detects no API Key, it will automatically skip translation without affecting deployment.
- Go to your GitHub repository -> Settings -> Secrets and variables -> Actions, and delete
- Clean up unnecessary files:
- Delete the language folder you don’t need (e.g.,
content/en). - Also check
_quarto.ymland remove all links pointing to that folder (e.g., paths likecontent/en/...in the navbar or sidebar).
- Delete the language folder you don’t need (e.g.,
- Remove the language switcher:
- Open
_quarto.yml, find theinclude-after-bodysection, and delete the lineassets/html/include_lang_switch.html. - In the
navbarsettings, delete the navigation item related toicon: translate.
- Open
- Verify the configuration:
- Run
quarto previewlocally to confirm there are no errors. - After pushing, check if the GitHub Actions run is successful.
- Run
This way, your website becomes a single-language site.
7 Additional Tool: Automatic Conversion from LaTeX to Quarto Markdown
If you already have a large number of LaTeX (.tex) documents, this project also provides an automatic conversion script that can batch convert .tex files into Quarto Markdown (.qmd) format, facilitating migration and publishing.
You can view detailed usage instructions and examples in scripts/README.md. You are welcome to refer to and use this tool to improve content migration efficiency. However, please note that this script is still being continuously improved, so it is recommended to test it on a small scale first.
We hope this template helps you build an outstanding personal homepage! If you have any questions, feel free to leave a comment below or create an Issue on GitHub.