initial commit
This commit is contained in:
commit
d808819bc8
14 changed files with 327 additions and 0 deletions
.devcontainer.json.dockerignore.gitattributes.gitignore
.vscode
LICENSETaskfile.ymlarchetypes
tools/chores
53
.devcontainer.json
Normal file
53
.devcontainer.json
Normal file
|
@ -0,0 +1,53 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
|
||||
{
|
||||
"name": "Hugo",
|
||||
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
"image": "mcr.microsoft.com/devcontainers/go:1-bookworm",
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
||||
"ghcr.io/devcontainers/features/hugo:1": {
|
||||
// "version": "0.128.2",
|
||||
"version": "latest",
|
||||
"extended": true
|
||||
},
|
||||
"ghcr.io/devcontainers-contrib/features/apt-get-packages:1": {
|
||||
"packages": "git-flow"
|
||||
},
|
||||
"ghcr.io/devcontainers-contrib/features/go-task:1": {},
|
||||
// "ghcr.io/devcontainers/features/node:1": {},
|
||||
// SVG optimization tool
|
||||
"ghcr.io/devcontainers-contrib/features/npm-package:1": {
|
||||
"package": "svgo"
|
||||
}
|
||||
},
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"terminal.integrated.defaultProfile.linux": "zsh"
|
||||
},
|
||||
"extensions": [
|
||||
"gruntfuggly.todo-tree",
|
||||
"kaellarkin.hugo-shortcode-syntax",
|
||||
"mhutchie.git-graph",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"streetsidesoftware.code-spell-checker-german",
|
||||
"tamasfe.even-better-toml",
|
||||
"timonwong.shellcheck"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"postCreateCommand": "mkdir -p \"${HOME}/.oh-my-zsh/custom/completions\" && hugo completion zsh > \"${HOME}/.oh-my-zsh/custom/completions/_hugo\""
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
3
.dockerignore
Normal file
3
.dockerignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
/public
|
||||
/resources
|
||||
/.*
|
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.webp filter=lfs diff=lfs merge=lfs -text
|
||||
*.ico filter=lfs diff=lfs merge=lfs -text
|
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Generated files by hugo
|
||||
/public/
|
||||
/resources/_gen/
|
||||
/assets/jsconfig.json
|
||||
hugo_stats.json
|
||||
|
||||
# Executable may be added to repository
|
||||
hugo.exe
|
||||
hugo.darwin
|
||||
hugo.linux
|
||||
|
||||
# Temporary lock file while building
|
||||
/.hugo_build.lock
|
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"ms-vscode-remote.remote-containers",
|
||||
"simonsiefke.svg-preview"
|
||||
]
|
||||
}
|
9
.vscode/settings.json
vendored
Normal file
9
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"git.closeDiffOnOperation": true,
|
||||
"todo-tree.tree.showCountsInTree": true,
|
||||
"todo-tree.filtering.excludeGlobs": [
|
||||
"**/node_modules/*/**",
|
||||
"**/themes/**"
|
||||
],
|
||||
"cSpell.language": "en,de-DE"
|
||||
}
|
25
.vscode/tasks.json
vendored
Normal file
25
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Hugo: Server",
|
||||
"detail": "Run development server with hot reload",
|
||||
"type": "shell",
|
||||
"command": "hugo server --bind '0.0.0.0' --baseURL 'http://localhost:1313/' --gc --forceSyncStatic --cleanDestinationDir --buildDrafts --buildFuture --buildExpired",
|
||||
"presentation": {
|
||||
"echo": false,
|
||||
"reveal": "silent"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Hugo: Build",
|
||||
"detail": "Build this site for deployment",
|
||||
"type": "shell",
|
||||
"command": "hugo",
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
9
LICENSE
Normal file
9
LICENSE
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Yavook!de
|
||||
|
||||
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.
|
23
Taskfile.yml
Normal file
23
Taskfile.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
version: '3'
|
||||
|
||||
tasks:
|
||||
new-content:
|
||||
vars:
|
||||
content_file: content/{{ .content_section }}/{{ .NAME | default "new-post" }}/{{ .content_name | default "index" }}.md
|
||||
cmds:
|
||||
- hugo new content --kind "{{ .content_kind | default "default" }}" "{{ .content_file }}"
|
||||
- code --reuse-window "{{ .content_file }}"
|
||||
|
||||
new-post:
|
||||
cmds:
|
||||
- task: new-content
|
||||
vars:
|
||||
content_section: blog
|
||||
content_name:
|
||||
ref: .content_name
|
||||
|
||||
new-post-en:
|
||||
cmds:
|
||||
- task: new-post
|
||||
vars:
|
||||
content_name: index.en
|
11
archetypes/default.md
Normal file
11
archetypes/default.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
+++
|
||||
title = "{{ replace .File.ContentBaseName "-" " " | title }}"
|
||||
summary = ""
|
||||
tags = []
|
||||
|
||||
date = "{{ time.Now.Format "2006-01-02" }}"
|
||||
# lastmod =
|
||||
|
||||
draft = true
|
||||
# showDateUpdated = true
|
||||
+++
|
50
tools/chores/.publish/Dockerfile
Normal file
50
tools/chores/.publish/Dockerfile
Normal file
|
@ -0,0 +1,50 @@
|
|||
##############
|
||||
# build site #
|
||||
##############
|
||||
|
||||
ARG DEBIAN_VERSION=bookworm-slim
|
||||
FROM debian:${DEBIAN_VERSION} AS build
|
||||
|
||||
ARG HUGO_VERSION
|
||||
ARG HUGO_FILENAME=hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
|
||||
# env setup
|
||||
WORKDIR /usr/local/src/hugo-site
|
||||
|
||||
# install hugo
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; apt-get install -y \
|
||||
curl \
|
||||
; \
|
||||
\
|
||||
curl -sSL -o /tmp/hugo.deb \
|
||||
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_FILENAME}"; \
|
||||
apt-get install -y /tmp/hugo.deb; \
|
||||
rm -f /tmp/hugo.deb; \
|
||||
\
|
||||
apt-get autoremove --purge -y \
|
||||
curl \
|
||||
; rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# copy and build site
|
||||
COPY ./ ./
|
||||
RUN hugo \
|
||||
--cleanDestinationDir \
|
||||
--minify \
|
||||
--destination /tmp/hugo-site/html
|
||||
|
||||
##############
|
||||
# serve site #
|
||||
##############
|
||||
|
||||
FROM nginx:mainline-alpine AS production
|
||||
|
||||
# remove default site
|
||||
RUN rm -rf /usr/share/nginx/html
|
||||
|
||||
# add conf.d directory
|
||||
COPY tools/chores/.publish/nginx_conf.d /etc/nginx/conf.d
|
||||
|
||||
# add built site
|
||||
COPY --from=build /tmp/hugo-site/html /usr/share/nginx/html
|
71
tools/chores/.publish/nginx_conf.d/compression.conf
Normal file
71
tools/chores/.publish/nginx_conf.d/compression.conf
Normal file
|
@ -0,0 +1,71 @@
|
|||
# ----------------------------------------------------------------------
|
||||
# | Compression |
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# https://nginx.org/en/docs/http/ngx_http_gzip_module.html
|
||||
|
||||
# Enable gzip compression.
|
||||
# Default: off
|
||||
gzip on;
|
||||
|
||||
# Compression level (1-9).
|
||||
# 5 is a perfect compromise between size and CPU usage, offering about 75%
|
||||
# reduction for most ASCII files (almost identical to level 9).
|
||||
# Default: 1
|
||||
gzip_comp_level 5;
|
||||
|
||||
# Don't compress anything that's already small and unlikely to shrink much if at
|
||||
# all (the default is 20 bytes, which is bad as that usually leads to larger
|
||||
# files after gzipping).
|
||||
# Default: 20
|
||||
gzip_min_length 256;
|
||||
|
||||
# Compress data even for clients that are connecting to us via proxies,
|
||||
# identified by the "Via" header (required for CloudFront).
|
||||
# Default: off
|
||||
gzip_proxied any;
|
||||
|
||||
# Tell proxies to cache both the gzipped and regular version of a resource
|
||||
# whenever the client's Accept-Encoding capabilities header varies;
|
||||
# Avoids the issue where a non-gzip capable client (which is extremely rare
|
||||
# today) would display gibberish if their proxy gave them the gzipped version.
|
||||
# Default: off
|
||||
gzip_vary on;
|
||||
|
||||
# Compress all output labeled with one of the following MIME-types.
|
||||
# `text/html` is always compressed by gzip module.
|
||||
# Default: text/html
|
||||
gzip_types
|
||||
application/atom+xml
|
||||
application/geo+json
|
||||
application/javascript
|
||||
application/x-javascript
|
||||
application/json
|
||||
application/ld+json
|
||||
application/manifest+json
|
||||
application/rdf+xml
|
||||
application/rss+xml
|
||||
application/vnd.ms-fontobject
|
||||
application/wasm
|
||||
application/x-web-app-manifest+json
|
||||
application/xhtml+xml
|
||||
application/xml
|
||||
font/eot
|
||||
font/otf
|
||||
font/ttf
|
||||
image/bmp
|
||||
image/svg+xml
|
||||
image/vnd.microsoft.icon
|
||||
image/x-icon
|
||||
text/cache-manifest
|
||||
text/calendar
|
||||
text/css
|
||||
text/javascript
|
||||
text/markdown
|
||||
text/plain
|
||||
text/xml
|
||||
text/vcard
|
||||
text/vnd.rim.location.xloc
|
||||
text/vtt
|
||||
text/x-component
|
||||
text/x-cross-domain-policy;
|
31
tools/chores/.publish/nginx_conf.d/default.conf
Normal file
31
tools/chores/.publish/nginx_conf.d/default.conf
Normal file
|
@ -0,0 +1,31 @@
|
|||
server {
|
||||
listen [::]:80;
|
||||
listen 80;
|
||||
|
||||
server_name ~^www\.(?<domain>.+)$;
|
||||
return 301 https://$domain$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:80;
|
||||
listen 80 default_server;
|
||||
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
error_page 404 /404.html;
|
||||
}
|
||||
|
||||
location ~ '^/(?<lang_dir>\w{2})/' {
|
||||
error_page 404 /${lang_dir}/404.html;
|
||||
}
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
|
||||
# error_page 500 502 503 504 /50x.html;
|
||||
# location = /50x.html {
|
||||
# root /usr/share/nginx/html;
|
||||
# }
|
||||
}
|
19
tools/chores/publish
Executable file
19
tools/chores/publish
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
script="$( readlink -f "${0}" )"
|
||||
script_dir="$( dirname "${script}" )"
|
||||
repo_dir="$( readlink -f "${script_dir}/../.." )"
|
||||
|
||||
# get hugo feature version from devcontainer.json
|
||||
dc_json_file="${repo_dir}/.devcontainer.json"
|
||||
HUGO_VERSION=$( grep -A3 'features/hugo' "${dc_json_file}" | grep 'version' | sed -r 's/^.*"([^"]+)",?\s*$/\1/' )
|
||||
|
||||
# TODO add --push to publish to registry
|
||||
# TODO change --tag value
|
||||
docker buildx build \
|
||||
--pull \
|
||||
--file "${script_dir}/.publish/Dockerfile" \
|
||||
--build-arg "HUGO_VERSION=${HUGO_VERSION}" \
|
||||
--tag "localhost/hugo-site:latest" \
|
||||
--platform "linux/amd64" \
|
||||
"${repo_dir}"
|
Loading…
Reference in a new issue