Skip to content

Commit 9305162

Browse files
authored
Initial commit
0 parents  commit 9305162

File tree

17 files changed

+371
-0
lines changed

17 files changed

+371
-0
lines changed

.devcontainer/devcontainer.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/go:1",
3+
"features": {
4+
"ghcr.io/devcontainers/features/hugo:1": {
5+
"extended": true,
6+
"version": "0.122.0"
7+
},
8+
"ghcr.io/devcontainers/features/node:1": {}
9+
},
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"mhutchie.git-graph",
14+
"esbenp.prettier-vscode",
15+
"tamasfe.even-better-toml",
16+
"budparr.language-hugo-vscode"
17+
]
18+
}
19+
},
20+
"forwardPorts": [1313]
21+
}

.github/workflows/pages.yaml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
2+
name: Deploy Hugo site to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
# Default to bash
25+
defaults:
26+
run:
27+
shell: bash
28+
29+
jobs:
30+
# Build job
31+
build:
32+
runs-on: ubuntu-latest
33+
env:
34+
HUGO_VERSION: 0.124.1
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0 # fetch all history for .GitInfo and .Lastmod
40+
submodules: recursive
41+
- name: Setup Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: '1.22'
45+
- name: Setup Pages
46+
id: pages
47+
uses: actions/configure-pages@v4
48+
- name: Setup Hugo
49+
run: |
50+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
51+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
52+
- name: Build with Hugo
53+
env:
54+
# For maximum backward compatibility with Hugo modules
55+
HUGO_ENVIRONMENT: production
56+
HUGO_ENV: production
57+
run: |
58+
hugo \
59+
--gc --minify \
60+
--baseURL "${{ steps.pages.outputs.base_url }}/"
61+
- name: Upload artifact
62+
uses: actions/upload-pages-artifact@v3
63+
with:
64+
path: ./public
65+
66+
# Deployment job
67+
deploy:
68+
environment:
69+
name: github-pages
70+
url: ${{ steps.deployment.outputs.page_url }}
71+
runs-on: ubuntu-latest
72+
needs: build
73+
steps:
74+
- name: Deploy to GitHub Pages
75+
id: deployment
76+
uses: actions/deploy-pages@v4

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Hugo output
2+
public/
3+
resources/
4+
.hugo_build.lock
5+
6+
# Editor
7+
.vscode/

.gitpod.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6+
7+
tasks:
8+
- name: Install Hugo
9+
before: brew install hugo
10+
init: echo "Your version of Hugo is `hugo version`" && hugo mod tidy
11+
command: hugo server -D -F --baseURL $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0 --disableFastRender
12+
13+
ports:
14+
- port: 1313
15+
onOpen: open-preview

.vscode/extensions.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"mhutchie.git-graph",
8+
"esbenp.prettier-vscode",
9+
"tamasfe.even-better-toml",
10+
"budparr.language-hugo-vscode"
11+
]
12+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Xin
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

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Hextra Starter Template
2+
3+
[![Deploy Hugo site to Pages](https://github.com/imfing/hextra-starter-template/actions/workflows/pages.yaml/badge.svg)](https://github.com/imfing/hextra-starter-template/actions/workflows/pages.yaml)
4+
[![Netlify Status](https://api.netlify.com/api/v1/badges/6e83fd88-5ffe-4808-9689-c0f3b100bfe3/deploy-status)](https://app.netlify.com/sites/hextra-starter-template/deploys)
5+
![Vercel Deployment Status](https://img.shields.io/github/deployments/imfing/hextra-starter-template/production?logo=vercel&logoColor=white&label=vercel&labelColor=black&link=https%3A%2F%2Fhextra-starter-template.vercel.app%2F)
6+
7+
8+
🐣 Minimal template for getting started with [Hextra](https://github.com/imfing/hextra)
9+
10+
![hextra-template](https://github.com/imfing/hextra-starter-template/assets/5097752/c403b9a9-a76c-47a6-8466-513d772ef0b7)
11+
12+
[🌐 Demo ↗](https://imfing.github.io/hextra-starter-template/)
13+
14+
## Quick Start
15+
16+
Use this template to create your own repository:
17+
18+
<img src="https://docs.github.com/assets/cb-77734/mw-1440/images/help/repository/use-this-template-button.webp" width=400 />
19+
20+
You can also quickly start developing using the following online development environment:
21+
22+
- [GitHub Codespaces](https://github.com/codespaces)
23+
24+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/imfing/hextra-starter-template)
25+
26+
Create a new codespace and follow the [Local Development](#local-development) to launch the preview
27+
28+
- [Gitpod](https://gitpod.io)
29+
30+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/imfing/hextra-starter-template)
31+
32+
33+
## Deployment
34+
35+
### GitHub Pages
36+
37+
A GitHub Actions workflow is provided in [`.github/workflows/pages.yaml`](./.github/workflows/pages.yaml) to [publish to GitHub Pages](https://github.blog/changelog/2022-07-27-github-pages-custom-github-actions-workflows-beta/) for free.
38+
39+
For details, see [Publishing with a custom GitHub Actions workflow](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow).
40+
41+
Note: in the settings, make sure to set the Pages deployment source to **GitHub Actions**:
42+
43+
<img src="https://github.com/imfing/hextra-starter-template/assets/5097752/99676430-884e-42ab-b901-f6534a0d6eee" width=600 />
44+
45+
[Run the workflow manually](https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow) if it's not triggered automatically.
46+
47+
### Netlify
48+
49+
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/imfing/hextra-starter-template)
50+
51+
### Vercel
52+
53+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fimfing%2Fhextra-starter-template&env=HUGO_VERSION)
54+
55+
Override the configuration:
56+
57+
<img src="https://github.com/imfing/hextra-starter-template/assets/5097752/e2e3cecd-c884-47ec-b064-14f896fee08d" width=600 />
58+
59+
## Local Development
60+
61+
Pre-requisites: [Hugo](https://gohugo.io/getting-started/installing/), [Go](https://golang.org/doc/install) and [Git](https://git-scm.com)
62+
63+
```shell
64+
# Clone the repo
65+
git clone https://github.com/imfing/hextra-starter-template.git
66+
67+
# Change directory
68+
cd hextra-starter-template
69+
70+
# Start the server
71+
hugo mod tidy
72+
hugo server --logLevel debug --disableFastRender -p 1313
73+
```
74+
75+
### Update theme
76+
77+
```shell
78+
hugo mod get -u
79+
hugo mod tidy
80+
```
81+
82+
See [Update modules](https://gohugo.io/hugo-modules/use-modules/#update-modules) for more details.
83+

content/_index.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: My Site
3+
toc: false
4+
---
5+
6+
This is the landing page.
7+
8+
## Explore
9+
10+
{{< cards >}}
11+
{{< card link="docs" title="Docs" icon="book-open" >}}
12+
{{< card link="about" title="About" icon="user" >}}
13+
{{< /cards >}}
14+
15+
## Documentation
16+
17+
For more information, visit [Hextra](https://imfing.github.io/hextra).

content/about.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: About
3+
type: about
4+
---
5+
6+
This is the about page.

content/docs/_index.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Documentation
3+
next: first-page
4+
---
5+
6+
This is a demo of the theme's documentation layout.
7+
8+
## Hello, World!
9+
10+
```go {filename="main.go"}
11+
package main
12+
13+
import "fmt"
14+
15+
func main() {
16+
fmt.Println("Hello, World!")
17+
}
18+
```

content/docs/first-page.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Demo Page
3+
type: docs
4+
prev: /
5+
next: docs/folder/
6+
---
7+
8+
A simple demo page.
9+

content/docs/folder/_index.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Folder
3+
type: docs
4+
prev: docs/first-page
5+
next: docs/folder/leaf
6+
sidebar:
7+
open: true
8+
---
9+
10+
Pages can be organized into folders.

content/docs/folder/leaf.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Leaf Page
3+
type: docs
4+
prev: docs/folder/
5+
---
6+
7+
This page is under a folder.

go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/imfing/hextra-starter-template
2+
3+
go 1.21
4+
5+
require github.com/imfing/hextra v0.7.3 // indirect

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/imfing/hextra v0.7.3 h1:dVGA1NTcWe+FaUMdrawEypPfrrmulq5NoK0we3nC330=
2+
github.com/imfing/hextra v0.7.3/go.mod h1:cEfel3lU/bSx7lTE/+uuR4GJaphyOyiwNR3PTqFTXpI=

hugo.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Hugo configuration file
2+
title: My Site
3+
4+
# import hextra as module
5+
module:
6+
imports:
7+
- path: github.com/imfing/hextra
8+
9+
markup:
10+
# allow raw html
11+
goldmark:
12+
renderer:
13+
unsafe: true
14+
15+
# enable hextra syntax highlight
16+
highlight:
17+
noClasses: false
18+
19+
menu:
20+
main:
21+
- name: Docs
22+
pageRef: /docs
23+
weight: 1
24+
- name: About
25+
pageRef: /about
26+
weight: 2
27+
- name: Contact ↗
28+
url: "https://github.com/imfing"
29+
weight: 3
30+
- name: Search
31+
weight: 4
32+
params:
33+
type: search
34+
- name: GitHub
35+
weight: 5
36+
url: "https://github.com/imfing/hextra-starter-template"
37+
params:
38+
icon: github
39+
- name: Twitter
40+
weight: 6
41+
url: "https://twitter.com/"
42+
params:
43+
icon: x-twitter
44+
45+
params:
46+
navbar:
47+
displayTitle: true
48+
displayLogo: false
49+
50+
footer:
51+
displayCopyright: false
52+
displayPoweredBy: true
53+
54+
editURL:
55+
enable: true
56+
base: "https://github.com/imfing/hextra-starter-template/edit/main/content"

netlify.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build]
2+
publish = "public"
3+
command = "hugo --gc --minify -b ${DEPLOY_PRIME_URL}"
4+
5+
[build.environment]
6+
HUGO_VERSION = "0.121.1"

0 commit comments

Comments
 (0)