Skip to content

Commit 12d9d66

Browse files
committed
first commit
0 parents  commit 12d9d66

35 files changed

Lines changed: 2148 additions & 0 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
config/**/*.toml linguist-detectable
2+
content/**/*.md linguist-detectable

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "monthly"
12+
open-pull-requests-limit: 1000
13+
assignees:
14+
- "Lruihao"
15+
labels:
16+
- "dependencies"
17+
- package-ecosystem: "gitsubmodule" # See documentation for possible values
18+
directory: "/" # Location of package manifests
19+
schedule:
20+
interval: "monthly"
21+
open-pull-requests-limit: 1000
22+
assignees:
23+
- "Lruihao"
24+
labels:
25+
- "dependencies"

.github/workflows/deploy.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Hugo build and deploy
2+
on:
3+
push:
4+
branches: [ main ]
5+
paths:
6+
- 'assets/**'
7+
- 'config/**'
8+
- 'content/**'
9+
- 'data/**'
10+
- 'static/**'
11+
- 'themes/**'
12+
workflow_run:
13+
workflows: ['Update theme']
14+
types:
15+
- completed
16+
workflow_dispatch:
17+
18+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
19+
permissions:
20+
contents: read
21+
pages: write
22+
id-token: write
23+
24+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
25+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
26+
concurrency:
27+
group: "pages"
28+
cancel-in-progress: false
29+
30+
jobs:
31+
# Build job
32+
build:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Check out repository code
36+
uses: actions/checkout@v6
37+
with:
38+
submodules: true # Fetch Hugo themes (true OR recursive)
39+
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
40+
- name: Setup Hugo
41+
uses: peaceiris/actions-hugo@v3
42+
with:
43+
# use the environment variable HUGO_VERSION as the hugo version, if not set, use `latest`.
44+
hugo-version: ${{ vars.HUGO_VERSION || 'latest' }}
45+
extended: true
46+
- name: Hugo build
47+
run: hugo --gc --minify --logLevel info
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v4
50+
with:
51+
# Upload only the public directory
52+
path: './public'
53+
54+
# Deployment job
55+
deploy:
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
runs-on: ubuntu-latest
60+
needs: build
61+
steps:
62+
- uses: actions/checkout@v6
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v5
66+

.github/workflows/update-theme.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Update theme
2+
3+
# Controls when the workflow will run
4+
on:
5+
schedule:
6+
# Update theme automatically everyday at 00:00 UTC
7+
- cron: '0 0 * * *'
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
Update-FixIt:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out repository code
16+
uses: actions/checkout@v6
17+
with:
18+
submodules: true
19+
fetch-depth: 0
20+
21+
- name: Configure git identity
22+
run: |
23+
git config --global user.name "github-actions[bot]"
24+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
25+
26+
- name: Update theme components
27+
run: |
28+
git submodule update --remote --merge
29+
30+
- uses: actions/setup-node@v6
31+
- name: Fetch and split theme configuration
32+
run: |
33+
npx fixit-cli split https://raw.githubusercontent.com/hugo-fixit/FixIt/refs/heads/main/hugo.toml
34+
rm -f config/_default/mediaTypes.toml
35+
rm -f config/_default/outputFormats.toml
36+
37+
- name: Commit changes
38+
uses: stefanzweifel/git-auto-commit-action@v7
39+
with:
40+
commit_message: 'chore(deps): update theme and components version'
41+
commit_author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
build/
3+
public/
4+
resources/
5+
6+
.hugo_build.lock
7+
_vendor
8+
jsconfig.json

.gitmodules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[submodule "themes/FixIt"]
2+
path = themes/FixIt
3+
url = https://github.com/hugo-fixit/FixIt.git
4+
branch = main
5+
[submodule "themes/shortcode-docs-bookmark"]
6+
path = themes/shortcode-docs-bookmark
7+
url = https://github.com/hugo-fixit/shortcode-docs-bookmark

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022-2024 Lruihao (https://lruihao.cn)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.en.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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

Comments
 (0)