From b04ee6b0fc2fd90dea1cbb6019e7967038f33ce5 Mon Sep 17 00:00:00 2001 From: josh Date: Thu, 21 Nov 2024 17:12:00 +0000 Subject: [PATCH] Initial commit --- .devcontainer/devcontainer.json | 21 +++++++++ .github/workflows/pages.yaml | 76 ++++++++++++++++++++++++++++++ .gitignore | 7 +++ .gitpod.yml | 15 ++++++ LICENSE | 21 +++++++++ README.md | 83 +++++++++++++++++++++++++++++++++ content/_index.md | 17 +++++++ content/about.md | 6 +++ content/docs/_index.md | 18 +++++++ content/docs/first-page.md | 9 ++++ content/docs/folder/_index.md | 10 ++++ content/docs/folder/leaf.md | 7 +++ go.mod | 5 ++ go.sum | 2 + hugo.yaml | 56 ++++++++++++++++++++++ netlify.toml | 6 +++ 16 files changed, 359 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/pages.yaml create mode 100644 .gitignore create mode 100644 .gitpod.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 content/_index.md create mode 100644 content/about.md create mode 100644 content/docs/_index.md create mode 100644 content/docs/first-page.md create mode 100644 content/docs/folder/_index.md create mode 100644 content/docs/folder/leaf.md create mode 100644 go.mod create mode 100644 go.sum create mode 100644 hugo.yaml create mode 100644 netlify.toml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..f25098b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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] +} diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml new file mode 100644 index 0000000..357dbce --- /dev/null +++ b/.github/workflows/pages.yaml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed5e96e --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Hugo output +public/ +resources/ +.hugo_build.lock + +# Editor +.vscode/ diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..8bc7732 --- /dev/null +++ b/.gitpod.yml @@ -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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..946f304 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b1ee95d --- /dev/null +++ b/README.md @@ -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: + + + +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**: + + + +[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: + + + +## 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. + diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..72f68d8 --- /dev/null +++ b/content/_index.md @@ -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). diff --git a/content/about.md b/content/about.md new file mode 100644 index 0000000..289d9c7 --- /dev/null +++ b/content/about.md @@ -0,0 +1,6 @@ +--- +title: About +type: about +--- + +This is the about page. diff --git a/content/docs/_index.md b/content/docs/_index.md new file mode 100644 index 0000000..73dfb20 --- /dev/null +++ b/content/docs/_index.md @@ -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!") +} +``` diff --git a/content/docs/first-page.md b/content/docs/first-page.md new file mode 100644 index 0000000..4af40a1 --- /dev/null +++ b/content/docs/first-page.md @@ -0,0 +1,9 @@ +--- +title: Demo Page +type: docs +prev: / +next: docs/folder/ +--- + +A simple demo page. + diff --git a/content/docs/folder/_index.md b/content/docs/folder/_index.md new file mode 100644 index 0000000..5050ade --- /dev/null +++ b/content/docs/folder/_index.md @@ -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. diff --git a/content/docs/folder/leaf.md b/content/docs/folder/leaf.md new file mode 100644 index 0000000..7c9ee2a --- /dev/null +++ b/content/docs/folder/leaf.md @@ -0,0 +1,7 @@ +--- +title: Leaf Page +type: docs +prev: docs/folder/ +--- + +This page is under a folder. diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..851fb99 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/imfing/hextra-starter-template + +go 1.21 + +require github.com/imfing/hextra v0.8.6 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..8cc7ebb --- /dev/null +++ b/go.sum @@ -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= diff --git a/hugo.yaml b/hugo.yaml new file mode 100644 index 0000000..30f9991 --- /dev/null +++ b/hugo.yaml @@ -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" diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..7604250 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,6 @@ +[build] +publish = "public" +command = "hugo --gc --minify -b ${DEPLOY_PRIME_URL}" + +[build.environment] +HUGO_VERSION = "0.132.2"