Skip to content

Commit 43af055

Browse files
authored
Initial commit
0 parents  commit 43af055

File tree

35 files changed

+899
-0
lines changed

35 files changed

+899
-0
lines changed

.devcontainer/Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Update the NODE_VERSION arg in docker-compose.yml to pick a Node version: 18, 16, 14
2+
ARG NODE_VERSION=16
3+
FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_VERSION}
4+
5+
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
6+
ARG VARIANT=hugo
7+
# VERSION can be either 'latest' or a specific version number
8+
ARG VERSION=latest
9+
10+
# Download Hugo
11+
RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \
12+
rm -rf /var/lib/apt/lists/* && \
13+
case ${VERSION} in \
14+
latest) \
15+
export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
16+
esac && \
17+
echo ${VERSION} && \
18+
case $(uname -m) in \
19+
aarch64) \
20+
export ARCH=ARM64 ;; \
21+
*) \
22+
export ARCH=64bit ;; \
23+
esac && \
24+
echo ${ARCH} && \
25+
wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-${ARCH}.tar.gz && \
26+
tar xf ${VERSION}.tar.gz && \
27+
mv hugo /usr/bin/hugo
28+
29+
# Hugo dev server port
30+
EXPOSE 1313
31+
32+
# [Optional] Uncomment this section to install additional OS packages you may want.
33+
#
34+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
35+
# && apt-get -y install --no-install-recommends <your-package-list-here>
36+
37+
# [Optional] Uncomment if you want to install more global node packages
38+
# RUN sudo -u node npm install -g <your-package-list-here>

.devcontainer/devcontainer.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "Hugo (Community)",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
// Update VARIANT to pick hugo variant.
7+
// Example variants: hugo, hugo_extended
8+
// Rebuild the container if it already exists to update.
9+
"VARIANT": "hugo_extended",
10+
// Update VERSION to pick a specific hugo version.
11+
// Example versions: latest, 0.73.0, 0,71.1
12+
// Rebuild the container if it already exists to update.
13+
"VERSION": "latest",
14+
// Update NODE_VERSION to pick the Node.js version: 12, 14
15+
"NODE_VERSION": "14"
16+
}
17+
},
18+
19+
// Configure tool-specific properties.
20+
"customizations": {
21+
// Configure properties specific to VS Code.
22+
"vscode": {
23+
// Set *default* container specific settings.json values on container create.
24+
"settings": {
25+
"html.format.templating": true
26+
},
27+
28+
// Add the IDs of extensions you want installed when the container is created.
29+
"extensions": [
30+
"tamasfe.even-better-toml",
31+
"davidanson.vscode-markdownlint"
32+
]
33+
}
34+
},
35+
36+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
37+
"forwardPorts": [
38+
1313
39+
],
40+
41+
// Use 'postCreateCommand' to run commands after the container is created.
42+
// "postCreateCommand": "uname -a",
43+
44+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
45+
"remoteUser": "node",
46+
"features": {
47+
"ghcr.io/devcontainers/features/go:1": {
48+
"version": "latest"
49+
}
50+
}
51+
}

.github/workflows/deploy.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy to Github Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
# Give the default GITHUB_TOKEN write permission to commit and push the
15+
# added or changed files to the repository.
16+
contents: write
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Cache Hugo resources
24+
uses: actions/cache@v4
25+
env:
26+
cache-name: cache-hugo-resources
27+
with:
28+
path: resources
29+
key: ${{ env.cache-name }}
30+
31+
- uses: actions/setup-go@v5
32+
with:
33+
go-version: "^1.17.0"
34+
- run: go version
35+
36+
- name: Setup Hugo
37+
uses: peaceiris/actions-hugo@v2
38+
with:
39+
hugo-version: "latest"
40+
extended: true
41+
42+
- name: Build
43+
run: hugo --minify --gc
44+
45+
- name: Deploy 🚀
46+
uses: JamesIves/github-pages-deploy-action@v4
47+
with:
48+
branch: gh-pages
49+
folder: public
50+
clean: true
51+
single-commit: true

.github/workflows/update-theme.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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-theme:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
# Give the default GITHUB_TOKEN write permission to commit and push the
17+
# added or changed files to the repository.
18+
contents: write
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup Hugo
24+
uses: peaceiris/actions-hugo@v2
25+
with:
26+
hugo-version: 0.123.8
27+
extended: true
28+
29+
- name: Update theme
30+
run: hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v3
31+
32+
- name: Tidy go.mod, go.sum
33+
run: hugo mod tidy
34+
35+
- name: Commit changes
36+
uses: stefanzweifel/git-auto-commit-action@v5
37+
with:
38+
commit_message: "CI: Update theme"

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public
2+
resources
3+
.hugo_build.lock

.vscode/tasks.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Serve Drafts",
8+
"type": "shell",
9+
"command": "hugo server -D",
10+
"group": {
11+
"kind": "test",
12+
"isDefault": true
13+
},
14+
"isBackground": true,
15+
"problemMatcher": []
16+
},
17+
{
18+
"label": "Build",
19+
"type": "shell",
20+
"command": "hugo",
21+
"group": {
22+
"kind": "build",
23+
"isDefault": true
24+
},
25+
"problemMatcher": []
26+
}
27+
]
28+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Jimmy Cai
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.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<img align="right" width="150" alt="logo" src="https://user-images.githubusercontent.com/5889006/190859553-5b229b4f-c476-4cbd-928f-890f5265ca4c.png">
2+
3+
# Hugo Theme Stack Starter Template
4+
5+
This is a quick start template for [Hugo theme Stack](https://github.com/CaiJimmy/hugo-theme-stack). It uses [Hugo modules](https://gohugo.io/hugo-modules/) feature to load the theme.
6+
7+
It comes with a basic theme structure and configuration. GitHub action has been set up to deploy the theme to a public GitHub page automatically. Also, there's a cron job to update the theme automatically everyday.
8+
9+
## Get started
10+
11+
1. Click *Use this template*, and create your repository as `<username>.github.io` on GitHub.
12+
![Step 1](https://user-images.githubusercontent.com/5889006/156916624-20b2a784-f3a9-4718-aa5f-ce2a436b241f.png)
13+
14+
2. Once the repository is created, create a GitHub codespace associated with it.
15+
![Create codespace](https://user-images.githubusercontent.com/5889006/156916672-43b7b6e9-4ffb-4704-b4ba-d5ca40ffcae7.png)
16+
17+
3. And voila! You're ready to go. The codespace has been configured with the latest version of Hugo extended, just run `hugo server` in the terminal and see your new site in action.
18+
19+
4. Check `config` folder for the configuration files. You can edit them to suit your needs. Make sure to update the `baseurl` property in `config/_default/config.toml` to your site's URL.
20+
21+
5. Open Settings -> Pages. Change the build branch from `master` to `gh-pages`.
22+
![Build](https://github.com/namanh11611/hugo-theme-stack-starter/assets/16586200/12c763cd-bead-4923-b610-8788f388fcb5)
23+
24+
6. Once you're done editing the site, just commit it and push it. GitHub action will deploy the site automatically to GitHub page asociated with the repository.
25+
![GitHub action](https://user-images.githubusercontent.com/5889006/156916881-90b8bb9b-1925-4e60-9d7a-8026cda729bf.png)
26+
27+
---
28+
29+
In case you don't want to use GitHub codespace, you can also run this template in your local machine. **You need to install Git, Go and Hugo extended locally.**
30+
31+
## Update theme manually
32+
33+
Run:
34+
35+
```bash
36+
hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v3
37+
hugo mod tidy
38+
```
39+
40+
> This starter template has been configured with `v3` version of theme. Due to the limitation of Go module, once the `v4` or up version of theme is released, you need to update the theme manually. (Modifying `config/module.toml` file)
41+
42+
## Deploy to another static page hostings
43+
44+
If you want to build this site using another static page hosting, you need to make sure they have Go installed in the machine.
45+
46+
<details>
47+
<summary>Vercel</summary>
48+
49+
You need to overwrite build command to install manually Go:
50+
51+
```
52+
amazon-linux-extras install golang1.11 && hugo --gc --minify
53+
```
54+
55+
![](https://user-images.githubusercontent.com/5889006/156917172-01e4d418-3469-4ffb-97e4-a905d28b8424.png)
56+
57+
If you are using Node.js 20, you need to overwrite the install command to install manually Go:
58+
59+
```
60+
dnf install -y golang
61+
```
62+
63+
![image](https://github.com/zhi-yi-huang/hugo-theme-stack-starter/assets/83860323/777c1109-dfc8-4893-9db7-1305ec027cf5)
64+
65+
66+
Make sure also to specify Hugo version in the environment variable `HUGO_VERSION` (Use the latest version of Hugo extended):
67+
68+
![Environment variable](https://user-images.githubusercontent.com/5889006/156917212-afb7c70d-ab85-480f-8288-b15781a462c0.png)
69+
</details>

assets/img/avatar.png

410 Bytes
Loading

assets/scss/custom.scss

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*
2+
You can add your own custom styles here.
3+
*/

config/_default/_languages.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Rename this file to languages.toml to enable multilingual support
2+
[en]
3+
languageName = "English"
4+
languagedirection = "ltr"
5+
title = "Example Site"
6+
weight = 1

config/_default/config.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Change baseurl before deploy
2+
baseurl = "https://demo.stack.jimmycai.com"
3+
languageCode = "en-us"
4+
title = "Hugo Theme Stack Starter"
5+
6+
# Theme i18n support
7+
# Available values: en, fr, id, ja, ko, pt-br, zh-cn, zh-tw, es, de, nl, it, th, el, uk, ar
8+
defaultContentLanguage = "en"
9+
10+
# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
11+
# This will make .Summary and .WordCount behave correctly for CJK languages.
12+
hasCJKLanguage = false
13+
14+
# Change it to your Disqus shortname before using
15+
disqusShortname = "hugo-theme-stack"
16+
17+
[pagination]
18+
pagerSize = 5

config/_default/markup.toml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Markdown renderer configuration
2+
[goldmark.renderer]
3+
unsafe = true
4+
5+
[goldmark.extensions.passthrough]
6+
enable = true
7+
8+
# LaTeX math support
9+
# https://gohugo.io/content-management/mathematics/
10+
[goldmark.extensions.passthrough.delimiters]
11+
block = [['\[', '\]'], ['$$', '$$']]
12+
inline = [['\(', '\)']]
13+
14+
[tableOfContents]
15+
endLevel = 4
16+
ordered = true
17+
startLevel = 2
18+
19+
[highlight]
20+
noClasses = false
21+
codeFences = true
22+
guessSyntax = true
23+
lineNoStart = 1
24+
lineNos = true
25+
lineNumbersInTable = true
26+
tabWidth = 4

config/_default/menu.toml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Configure main menu and social menu
2+
#[[main]]
3+
#identifier = "home"
4+
#name = "Home"
5+
#url = "/"
6+
#[main.params]
7+
#icon = "home"
8+
#newtab = true
9+
10+
[[social]]
11+
identifier = "github"
12+
name = "GitHub"
13+
url = "https://github.com/CaiJimmy/hugo-theme-stack"
14+
15+
[social.params]
16+
icon = "brand-github"
17+
18+
[[social]]
19+
identifier = "twitter"
20+
name = "Twitter"
21+
url = "https://twitter.com"
22+
23+
[social.params]
24+
icon = "brand-twitter"

config/_default/module.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[[imports]]
2+
path = "github.com/CaiJimmy/hugo-theme-stack/v3"

0 commit comments

Comments
 (0)