|
| 1 | +# Hugo FixIt Blog Template (Git) |
| 2 | + |
| 3 | +👉 English | [简体中文](README.md) |
| 4 | + |
| 5 | +This is a quick start template for Hugo theme [FixIt](https://github.com/hugo-fixit/FixIt). It uses [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) feature to load the theme. If you favor Go more, you can [check this template](https://github.com/hugo-fixit/hugo-fixit-starter). |
| 6 | + |
| 7 | +It comes with a basic theme structure and [configuration directory](https://gohugo.io/configuration/introduction/#configuration-directory)[^1]. GitHub action has been set up to deploy the blog to a public GitHub page automatically. Also, there's a cron job to update the theme automatically everyday. |
| 8 | + |
| 9 | +[^1]: Instead of a single site configuration file, split your configuration by environment, root configuration key, and language. |
| 10 | + |
| 11 | +## Directory structure |
| 12 | + |
| 13 | +```bash |
| 14 | +▸ .github/ # GitHub configuration |
| 15 | +▸ archetypes/ # page archetypes (like scaffolds of archetypes) |
| 16 | +▸ assets/ # css, js, third-party libraries etc. |
| 17 | +▸ config/ # configuration files |
| 18 | +▸ content/ # markdown files for hugo project |
| 19 | +▸ data/ # blog data (allow: yaml, json, toml), e.g. friends.yml |
| 20 | +▸ public/ # build directory |
| 21 | +▸ static/ # static files, e.g. favicon.ico |
| 22 | +▸ themes/ # theme submodules |
| 23 | +``` |
| 24 | + |
| 25 | +## Quick Start |
| 26 | + |
| 27 | +For a complete quick start, see this [page](https://fixit.lruihao.cn/documentation/getting-started/). |
| 28 | + |
| 29 | +### Prerequisites |
| 30 | + |
| 31 | +[Hugo](https://gohugo.io/installation/): >= 0.132.0 (extended version) |
| 32 | + |
| 33 | +### Use this Template |
| 34 | + |
| 35 | +#### CLI |
| 36 | + |
| 37 | +```bash |
| 38 | +npx fixit-cli create my-blog |
| 39 | +``` |
| 40 | + |
| 41 | +#### Manual |
| 42 | + |
| 43 | +1. Click [**Use this template**](https://github.com/hugo-fixit/hugo-fixit-starter1/generate), and create your repository on GitHub. |
| 44 | + |
| 45 | + <img width="913" alt="image" src="https://github.com/hugo-fixit/hugo-fixit-starter1/assets/33419593/d5fbd940-3ffd-4750-b1e6-4e87b50b0696"> |
| 46 | + |
| 47 | +2. Once the repository is created, just clone and enjoy it! |
| 48 | + |
| 49 | + ```bash |
| 50 | + # Clone with your own repository url |
| 51 | + git clone --recursive https://github.com/<your_name>/<your_blog_repo>.git |
| 52 | + ``` |
| 53 | + |
| 54 | +> [!TIP] |
| 55 | +> The repository name determines your GitHub Pages URL, for example: |
| 56 | +> |
| 57 | +> | Repository Name | GitHub Pages | |
| 58 | +> | :--- | :--- | |
| 59 | +> | `<your_name>.github.io` | `https://<your_name>.github.io/` | |
| 60 | +> | `blog` | `https://<your_name>.github.io/blog/` | |
| 61 | + |
| 62 | +### Launching the Site |
| 63 | + |
| 64 | +```bash |
| 65 | +# Development environment |
| 66 | +hugo server |
| 67 | +# Production environment |
| 68 | +hugo server -e production |
| 69 | +``` |
| 70 | + |
| 71 | +### Build the Site |
| 72 | + |
| 73 | +When your site is ready to deploy, run the following command: |
| 74 | + |
| 75 | +```bash |
| 76 | +hugo |
| 77 | +``` |
| 78 | + |
| 79 | +### Deploy to GitHub Pages |
| 80 | + |
| 81 | +> [!NOTE] |
| 82 | +> You may have noticed that the first automatic deployment of GitHub Actions after the template initialization failed. This is because you have not configured Workflow permissions and GitHub Pages. |
| 83 | + |
| 84 | +1. Head to Setting => Actions => General => Workflow permissions => Check "Read and write permissions". |
| 85 | +2. GitHub Pages settings: Setting => Pages => Source: GitHub Actions. |
| 86 | +3. Modify `config/_default/hugo.toml` file `baseURL` to your site URL. |
| 87 | +4. Commit the changes from the previous step to the `main` branch, and GitHub Actions will automatically build and deploy the site to GitHub Pages. |
| 88 | + |
| 89 | +### Update theme |
| 90 | + |
| 91 | +Afterwards you can upgrade the theme with the following command: |
| 92 | + |
| 93 | +```bash |
| 94 | +# Update theme manually |
| 95 | +git submodule update --remote --merge themes/FixIt |
| 96 | +``` |
| 97 | + |
| 98 | +<details> |
| 99 | + <summary>Start via NPM script</summary> |
| 100 | + |
| 101 | + ```bash |
| 102 | + npm install |
| 103 | + # build the blog |
| 104 | + npm run build |
| 105 | + # run a local debugging server with watch |
| 106 | + npm run server |
| 107 | + # run a local debugging server in production environment |
| 108 | + npm run server:production |
| 109 | + # update theme submodules |
| 110 | + npm run update:theme |
| 111 | + ``` |
| 112 | + |
| 113 | +</details> |
| 114 | + |
| 115 | +## Troubleshooting |
| 116 | + |
| 117 | +<details> |
| 118 | + <summary>remote: Permission to git denied to github-actions[bot].</summary> |
| 119 | + Head to Setting => Actions => General => Workflow permissions => Check "Read and write permissions". |
| 120 | +</details> |
| 121 | + |
| 122 | +<!-- This project was generated with [hugo-fixit-starter1](https://github.com/hugo-fixit/hugo-fixit-starter1). --> |
0 commit comments