diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e614204..76e1150 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,17 +32,13 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/flake-checker-action@main - name: Build with Hugo - run: | - nix develop --command bash -c "hugo \ - --environment production \ - --minify \ - --baseURL '${{ steps.pages.outputs.base_url }}/'" + run: nix run . - name: Upload to GitHub Pages uses: actions/upload-pages-artifact@main with: path: ./public - name: Upload to Netim FTP - uses: SamKirkland/FTP-Deploy-Action@main + uses: SamKirkland/FTP-Deploy-Action@master with: server: ftp.netim.hosting username: AS12798_FTP1 diff --git a/archetypes/blog.md b/archetypes/blog.md index 9b03f36..1ca1aeb 100644 --- a/archetypes/blog.md +++ b/archetypes/blog.md @@ -1,6 +1,6 @@ --- -title: {{ replace .Name "-" " " | title }} -date: {{ .Date }} +title: { { replace .Name "-" " " | title } } +date: { { .Date } } description: tags: draft: true diff --git a/archetypes/default.md b/archetypes/default.md index 29346c2..2e04cd5 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,5 +1,5 @@ --- -title: {{ replace .Name "-" " " | title }} -date: {{ .Date }} +title: { { replace .Name "-" " " | title } } +date: { { .Date } } draft: true --- diff --git a/archetypes/micro.md b/archetypes/micro.md index 0bd066a..ddb51a9 100644 --- a/archetypes/micro.md +++ b/archetypes/micro.md @@ -1,6 +1,6 @@ --- -title: {{ replace .Name "-" " " | title }} -date: {{ .Date }} +title: { { replace .Name "-" " " | title } } +date: { { .Date } } tags: - micro draft: true diff --git a/archetypes/photos.md b/archetypes/photos.md index 2fcef3e..be828e1 100644 --- a/archetypes/photos.md +++ b/archetypes/photos.md @@ -1,6 +1,6 @@ --- -title: {{ replace .Name "-" " " | title }} -date: {{ .Date }} +title: { { replace .Name "-" " " | title } } +date: { { .Date } } description: feature: tags: diff --git a/assets/css/main.css b/assets/css/main.css index 53dfbe4..7673544 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -39,7 +39,9 @@ code { body { color: var(--text); background: var(--background); - font-family: "EB Garamond", Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Athelas, Georgia, serif; + font-family: "EB Garamond", Constantia, "Lucida Bright", Lucidabright, + "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", + "Liberation Serif", Athelas, Georgia, serif; /* font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir, "Nimbus Sans L", Roboto, Noto, "Segoe UI", Arial, Helvetica, "Helvetica Neue", sans-serif; */ font-variant-numeric: oldstyle-nums; line-height: 1.5; @@ -54,9 +56,7 @@ header { margin-bottom: 1rem; & nav { - & ul { - font-size: 1.25rem; list-style: none; display: flex; @@ -66,7 +66,6 @@ header { .active { text-decoration: underline; } - } } } @@ -78,7 +77,7 @@ p { text-justify: inter-word; } -article>p:nth-of-type(2)::first-letter { +article > p:nth-of-type(2)::first-letter { font-size: 3rem; float: left; line-height: 2.9rem; @@ -166,7 +165,6 @@ footer { text-align: left; text-decoration: none; } - } .tags { diff --git a/flake.lock b/flake.lock index 8ba4e3f..f17459b 100644 --- a/flake.lock +++ b/flake.lock @@ -16,9 +16,59 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1719690277, + "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "systems": "systems", + "treefmt": "treefmt" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "treefmt": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1719887753, + "narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index b043e5e..de0f418 100644 --- a/flake.nix +++ b/flake.nix @@ -1,36 +1,64 @@ { description = "Hugo website"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.treefmt.url = "github:numtide/treefmt-nix"; outputs = - { nixpkgs, ... }: + { + self, + nixpkgs, + systems, + treefmt, + ... + }: let - systems = [ - "x86_64-linux" - "x86_64-darwin" - ]; - forAllSystems = f: nixpkgs.lib.genAttrs (systems) f; + eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system}); - devShell = - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - default = - with pkgs; - mkShell { - name = "Hugo website"; - packages = with pkgs; [ - go - hugo - nodePackages.prettier - ]; - }; - }; + treefmtEval = eachSystem (pkgs: treefmt.lib.evalModule pkgs ./treefmt.nix); in { - devShells = forAllSystems devShell; - formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); + devShells = eachSystem (pkgs: { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + go + hugo + ]; + }; + }); + + formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper); + + checks = eachSystem (pkgs: { + formatting = treefmtEval.${pkgs.system}.config.build.check self; + }); + + apps = eachSystem (pkgs: { + default = { + type = "app"; + program = + (pkgs.writeShellScript "build-website" '' + set -e + ${pkgs.hugo}/bin/hugo --minify + '').outPath; + }; + + test = { + type = "app"; + program = + (pkgs.writeShellScript "test-website" '' + set -e + ${pkgs.hugo}/bin/hugo --environment="development" + '').outPath; + }; + + server = { + type = "app"; + program = + (pkgs.writeShellScript "serve-website" '' + set -e + ${pkgs.hugo}/bin/hugo server + '').outPath; + }; + }); }; } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 928e7ec..fc6f0d8 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,21 +1,15 @@ - - - - - {{ partial "head.html" . }} - - - -
- {{ partial "header.html" . }} -
-
- {{ block "main" . }}{{ end }} -
- - + + + + {{ partial "head.html" . }} + + +
{{ partial "header.html" . }}
+
{{ block "main" . }}{{ end }}
+ + diff --git a/layouts/_default/home.html b/layouts/_default/home.html index 2807fa3..4461906 100644 --- a/layouts/_default/home.html +++ b/layouts/_default/home.html @@ -1,11 +1,9 @@ -{{ define "main" }} -{{ .Content }} -{{ $pages := .Paginate (where .Site.RegularPages "Type" "ne" "page") }} -{{ range $pages.Pages }} - +{{ define "main" }} {{ .Content }} {{ $pages := .Paginate (where +.Site.RegularPages "Type" "ne" "page") }} {{ range $pages.Pages }} +
- {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} - {{ $dateHuman := .Date | time.Format "2006-01-02" }} + {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} {{ + $dateHuman := .Date | time.Format "2006-01-02" }}

{{ .Title }}

@@ -13,5 +11,4 @@

{{ .Description }}

-{{ end }} -{{ end }} +{{ end }} {{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 6883454..fc5a025 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,10 +1,8 @@ -{{ define "main" }} -{{ .Content }} -{{ range .Pages }} - +{{ define "main" }} {{ .Content }} {{ range .Pages }} +
- {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} - {{ $dateHuman := .Date | time.Format "2006-01-02" }} + {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} {{ + $dateHuman := .Date | time.Format "2006-01-02" }}

{{ .Title }}

@@ -12,5 +10,4 @@

{{ .Description }}

-{{ end }} -{{ end }} +{{ end }} {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 081801f..5a75550 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,9 +1,9 @@ {{ define "main" }}
- {{ $dateMachine := .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }} - {{ $dateHuman := .Lastmod | time.Format "2006-01-02" }} + {{ $dateMachine := .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }} {{ + $dateHuman := .Lastmod | time.Format "2006-01-02" }} -
+

{{ .Title }}

@@ -11,5 +11,4 @@ {{ .Content }}
-{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} -{{ end }} +{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} {{ end }} diff --git a/layouts/partials/head/analytics.html b/layouts/partials/head/analytics.html index 26544db..487d31f 100644 --- a/layouts/partials/head/analytics.html +++ b/layouts/partials/head/analytics.html @@ -1,3 +1,7 @@ {{ if hugo.IsProduction }} - + {{ end }} diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index d104e28..36cbbb4 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -1,9 +1,11 @@ -{{- with resources.Get "css/main.css" }} -{{- if eq hugo.Environment "development" }} - -{{- else }} -{{- with . | minify | fingerprint }} - -{{- end }} -{{- end }} -{{- end }} +{{- with resources.Get "css/main.css" }} {{- if eq hugo.Environment +"development" }} + +{{- else }} {{- with . | minify | fingerprint }} + +{{- end }} {{- end }} {{- end }} diff --git a/layouts/partials/head/js.html b/layouts/partials/head/js.html index 18fe842..14ef07b 100644 --- a/layouts/partials/head/js.html +++ b/layouts/partials/head/js.html @@ -1,12 +1,11 @@ -{{- with resources.Get "js/main.js" }} - {{- if eq hugo.Environment "development" }} - {{- with . | js.Build }} - - {{- end }} - {{- else }} - {{- $opts := dict "minify" true }} - {{- with . | js.Build $opts | fingerprint }} - - {{- end }} - {{- end }} -{{- end }} +{{- with resources.Get "js/main.js" }} {{- if eq hugo.Environment "development" +}} {{- with . | js.Build }} + +{{- end }} {{- else }} {{- $opts := dict "minify" true }} {{- with . | js.Build +$opts | fingerprint }} + +{{- end }} {{- end }} {{- end }} diff --git a/layouts/partials/terms.html b/layouts/partials/terms.html index c0d86d2..6b15311 100644 --- a/layouts/partials/terms.html +++ b/layouts/partials/terms.html @@ -1,17 +1,8 @@ -{{- /* -For a given taxonomy, renders a list of terms assigned to the page. - -@context {page} page The current page. -@context {string} taxonomy The taxonony. - -@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} -*/}} - -{{- $page := .page }} -{{- $taxonomy := .taxonomy }} - -{{- with $page.GetTerms $taxonomy }} -{{- $label := (index . 0).Parent.LinkTitle }} +{{- /* For a given taxonomy, renders a list of terms assigned to the page. +@context {page} page The current page. @context {string} taxonomy The taxonony. +@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} */}} {{- +$page := .page }} {{- $taxonomy := .taxonomy }} {{- with $page.GetTerms +$taxonomy }} {{- $label := (index . 0).Parent.LinkTitle }}