Initial commit

This commit is contained in:
2024-11-21 17:12:00 +00:00
commit b04ee6b0fc
16 changed files with 359 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
{
"image": "mcr.microsoft.com/devcontainers/go:1",
"features": {
"ghcr.io/devcontainers/features/hugo:1": {
"extended": true,
"version": "0.132.2"
},
"ghcr.io/devcontainers/features/node:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"mhutchie.git-graph",
"esbenp.prettier-vscode",
"tamasfe.even-better-toml",
"budparr.language-hugo-vscode"
]
}
},
"forwardPorts": [1313]
}

76
.github/workflows/pages.yaml vendored Normal file
View File

@@ -0,0 +1,76 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.132.2
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for .GitInfo and .Lastmod
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Setup Hugo
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc --minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
# Hugo output
public/
resources/
.hugo_build.lock
# Editor
.vscode/

15
.gitpod.yml Normal file
View File

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

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Xin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

83
README.md Normal file
View File

@@ -0,0 +1,83 @@
# Hextra Starter Template
[![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)
[![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)
![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)
🐣 Minimal template for getting started with [Hextra](https://github.com/imfing/hextra)
![hextra-template](https://github.com/imfing/hextra-starter-template/assets/5097752/c403b9a9-a76c-47a6-8466-513d772ef0b7)
[🌐 Demo ↗](https://imfing.github.io/hextra-starter-template/)
## Quick Start
Use this template to create your own repository:
<img src="https://docs.github.com/assets/cb-77734/mw-1440/images/help/repository/use-this-template-button.webp" width=400 />
You can also quickly start developing using the following online development environment:
- [GitHub Codespaces](https://github.com/codespaces)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/imfing/hextra-starter-template)
Create a new codespace and follow the [Local Development](#local-development) to launch the preview
- [Gitpod](https://gitpod.io)
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/imfing/hextra-starter-template)
## Deployment
### GitHub Pages
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.
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).
Note: in the settings, make sure to set the Pages deployment source to **GitHub Actions**:
<img src="https://github.com/imfing/hextra-starter-template/assets/5097752/99676430-884e-42ab-b901-f6534a0d6eee" width=600 />
[Run the workflow manually](https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow) if it's not triggered automatically.
### Netlify
[![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)
### Vercel
[![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)
Override the configuration:
<img src="https://github.com/imfing/hextra-starter-template/assets/5097752/e2e3cecd-c884-47ec-b064-14f896fee08d" width=600 />
## Local Development
Pre-requisites: [Hugo](https://gohugo.io/getting-started/installing/), [Go](https://golang.org/doc/install) and [Git](https://git-scm.com)
```shell
# Clone the repo
git clone https://github.com/imfing/hextra-starter-template.git
# Change directory
cd hextra-starter-template
# Start the server
hugo mod tidy
hugo server --logLevel debug --disableFastRender -p 1313
```
### Update theme
```shell
hugo mod get -u
hugo mod tidy
```
See [Update modules](https://gohugo.io/hugo-modules/use-modules/#update-modules) for more details.

17
content/_index.md Normal file
View File

@@ -0,0 +1,17 @@
---
title: My Site
toc: false
---
This is the landing page.
## Explore
{{< cards >}}
{{< card link="docs" title="Docs" icon="book-open" >}}
{{< card link="about" title="About" icon="user" >}}
{{< /cards >}}
## Documentation
For more information, visit [Hextra](https://imfing.github.io/hextra).

6
content/about.md Normal file
View File

@@ -0,0 +1,6 @@
---
title: About
type: about
---
This is the about page.

18
content/docs/_index.md Normal file
View File

@@ -0,0 +1,18 @@
---
title: Documentation
next: first-page
---
This is a demo of the theme's documentation layout.
## Hello, World!
```go {filename="main.go"}
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
```

View File

@@ -0,0 +1,9 @@
---
title: Demo Page
type: docs
prev: /
next: docs/folder/
---
A simple demo page.

View File

@@ -0,0 +1,10 @@
---
title: Folder
type: docs
prev: docs/first-page
next: docs/folder/leaf
sidebar:
open: true
---
Pages can be organized into folders.

View File

@@ -0,0 +1,7 @@
---
title: Leaf Page
type: docs
prev: docs/folder/
---
This page is under a folder.

5
go.mod Normal file
View File

@@ -0,0 +1,5 @@
module github.com/imfing/hextra-starter-template
go 1.21
require github.com/imfing/hextra v0.8.6 // indirect

2
go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/imfing/hextra v0.8.6 h1:fpOqzcUs26Lc/ZzowYSBcnpe00d/aZw4HhiHP7ycSks=
github.com/imfing/hextra v0.8.6/go.mod h1:cEfel3lU/bSx7lTE/+uuR4GJaphyOyiwNR3PTqFTXpI=

56
hugo.yaml Normal file
View File

@@ -0,0 +1,56 @@
# Hugo configuration file
title: My Site
# import hextra as module
module:
imports:
- path: github.com/imfing/hextra
markup:
# allow raw html
goldmark:
renderer:
unsafe: true
# enable hextra syntax highlight
highlight:
noClasses: false
menu:
main:
- name: Docs
pageRef: /docs
weight: 1
- name: About
pageRef: /about
weight: 2
- name: Contact ↗
url: "https://github.com/imfing"
weight: 3
- name: Search
weight: 4
params:
type: search
- name: GitHub
weight: 5
url: "https://github.com/imfing/hextra-starter-template"
params:
icon: github
- name: Twitter
weight: 6
url: "https://twitter.com/"
params:
icon: x-twitter
params:
navbar:
displayTitle: true
displayLogo: false
footer:
displayCopyright: false
displayPoweredBy: true
editURL:
enable: true
base: "https://github.com/imfing/hextra-starter-template/edit/main/content"

6
netlify.toml Normal file
View File

@@ -0,0 +1,6 @@
[build]
publish = "public"
command = "hugo --gc --minify -b ${DEPLOY_PRIME_URL}"
[build.environment]
HUGO_VERSION = "0.132.2"