From 10b809eebd9b54a83a81e4ffcd1feb361cc39e56 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 18 Nov 2022 23:26:44 +0100 Subject: [PATCH] Switch to Hugo-based build --- .gitignore | 6 +++ archetypes/default.md | 6 +++ config.toml | 5 ++ content/_index.md | 5 ++ flake.lock | 43 +++++++++++++++ flake.nix | 50 +++++++++++++++++ themes/custom/LICENSE | 20 +++++++ themes/custom/archetypes/default.md | 2 + themes/custom/assets/sass/main.scss | 62 ++++++++++++++++++++++ themes/custom/layouts/404.html | 0 themes/custom/layouts/_default/baseof.html | 11 ++++ themes/custom/layouts/_default/list.html | 0 themes/custom/layouts/_default/single.html | 0 themes/custom/layouts/index.html | 19 +++++++ themes/custom/layouts/partials/footer.html | 0 themes/custom/layouts/partials/head.html | 7 +++ themes/custom/layouts/partials/header.html | 0 themes/custom/theme.toml | 21 ++++++++ 18 files changed, 257 insertions(+) create mode 100644 .gitignore create mode 100644 archetypes/default.md create mode 100644 config.toml create mode 100644 content/_index.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 themes/custom/LICENSE create mode 100644 themes/custom/archetypes/default.md create mode 100644 themes/custom/assets/sass/main.scss create mode 100644 themes/custom/layouts/404.html create mode 100644 themes/custom/layouts/_default/baseof.html create mode 100644 themes/custom/layouts/_default/list.html create mode 100644 themes/custom/layouts/_default/single.html create mode 100644 themes/custom/layouts/index.html create mode 100644 themes/custom/layouts/partials/footer.html create mode 100644 themes/custom/layouts/partials/head.html create mode 100644 themes/custom/layouts/partials/header.html create mode 100644 themes/custom/theme.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b55ac26 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/.direnv/ +/.envrc +/public/ +/.hugo_build.lock +/resources/_gen/ +/result diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..00e77bd --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true +--- + diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..e1b2b6c --- /dev/null +++ b/config.toml @@ -0,0 +1,5 @@ +baseURL = 'https://antoinemartin.fr/' +languageCode = 'en-us' +title = 'Antoine Martin - Computer Person' +theme = 'custom' +enableRobotsTXT = true diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..5dfec6d --- /dev/null +++ b/content/_index.md @@ -0,0 +1,5 @@ +# Antoine Martin + +Computer Scientist in training. + +WIP. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ab4fbee --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "futils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1668765800, + "narHash": "sha256-rC40+/W6Hio7b/RsY8SvQPKNx4WqNcTgfYv8cUMAvJk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "52b2ac8ae18bbad4374ff0dd5aeee0fdf1aea739", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "futils": "futils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e7bf680 --- /dev/null +++ b/flake.nix @@ -0,0 +1,50 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + futils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + futils, + } @ inputs: let + inherit (nixpkgs) lib; + inherit (futils.lib) eachDefaultSystem defaultSystems; + in (eachDefaultSystem ( + system: let + pkgs = import nixpkgs {inherit system;}; + in { + packages = { + default = self.packages.${system}.website; + website = pkgs.stdenvNoCC.mkDerivation { + name = "antoinemartin.fr-website"; + + src = self; + + nativeBuildInputs = with pkgs; [ + hugo + ]; + + buildPhase = '' + hugo --minify + ''; + + installPhase = '' + cp -r public $out + ''; + + meta = with pkgs.lib; { + platforms = platforms.all; + }; + }; + }; + + devShell = pkgs.mkShellNoCC { + buildInputs = with pkgs; [ + hugo + ]; + }; + } + )); +} diff --git a/themes/custom/LICENSE b/themes/custom/LICENSE new file mode 100644 index 0000000..147d594 --- /dev/null +++ b/themes/custom/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2022 YOUR_NAME_HERE + +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/themes/custom/archetypes/default.md b/themes/custom/archetypes/default.md new file mode 100644 index 0000000..ac36e06 --- /dev/null +++ b/themes/custom/archetypes/default.md @@ -0,0 +1,2 @@ ++++ ++++ diff --git a/themes/custom/assets/sass/main.scss b/themes/custom/assets/sass/main.scss new file mode 100644 index 0000000..dc527b0 --- /dev/null +++ b/themes/custom/assets/sass/main.scss @@ -0,0 +1,62 @@ +// CSS heavily borrowed from https://github.com/denysvitali/thebestmotherfuckingwebsite + +$bodybgColor: #f2f2f2; +$bodyTextColor: #444444; + +$linkColor: #07A; +$linkVisitedColor: #941352; + +html { + background-color: $bodybgColor; +} + +body{ + font-family: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + color: $bodyTextColor; + font-size: 16px; + margin: 2em auto; + max-width: 800px; + padding: 1em; + line-height: 1.4; + text-align: justify; +} + +a{ + color: $linkColor; + + &:visited{ + color: $linkVisitedColor; + } +} + +.noselect{ + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + + +small{ + font-size: 0.4em; +} + +p.st{ + margin-top: -1em; +} + +ul{ + li{ + img{ + height: 1em; + } + } +} + +@media screen and (max-width: 500px) { + body{ + text-align: left; + } +} diff --git a/themes/custom/layouts/404.html b/themes/custom/layouts/404.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/custom/layouts/_default/baseof.html b/themes/custom/layouts/_default/baseof.html new file mode 100644 index 0000000..5f8e2ec --- /dev/null +++ b/themes/custom/layouts/_default/baseof.html @@ -0,0 +1,11 @@ + + + {{- partial "head.html" . -}} + + {{- partial "header.html" . -}} +
+ {{- block "main" . }}{{- end }} +
+ {{- partial "footer.html" . -}} + + diff --git a/themes/custom/layouts/_default/list.html b/themes/custom/layouts/_default/list.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/custom/layouts/_default/single.html b/themes/custom/layouts/_default/single.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/custom/layouts/index.html b/themes/custom/layouts/index.html new file mode 100644 index 0000000..b268e43 --- /dev/null +++ b/themes/custom/layouts/index.html @@ -0,0 +1,19 @@ +{{ define "main" }} +
+
+

{{.Title}}

+ {{ with .Params.subtitle }} + {{.}} + {{ end }} +
+
+ + {{.Content}} +
+
+ {{ range first 10 .Site.RegularPages }} + {{ .Render "summary"}} + {{ end }} +
+
+{{ end }} diff --git a/themes/custom/layouts/partials/footer.html b/themes/custom/layouts/partials/footer.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/custom/layouts/partials/head.html b/themes/custom/layouts/partials/head.html new file mode 100644 index 0000000..b91e3a3 --- /dev/null +++ b/themes/custom/layouts/partials/head.html @@ -0,0 +1,7 @@ + + + + {{ $sassOptions := (dict "targetPath" "style.css" "enableSourceMap" (not hugo.IsProduction)) }} + {{ $style := resources.Get "sass/main.scss" | resources.ToCSS $sassOptions }} + + diff --git a/themes/custom/layouts/partials/header.html b/themes/custom/layouts/partials/header.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/custom/theme.toml b/themes/custom/theme.toml new file mode 100644 index 0000000..938e229 --- /dev/null +++ b/themes/custom/theme.toml @@ -0,0 +1,21 @@ +# theme.toml template for a Hugo theme +# See https://github.com/gohugoio/hugoThemes#themetoml for an example + +name = "Custom" +license = "MIT" +licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE" +description = "" +homepage = "http://example.com/" +tags = [] +features = [] +min_version = "0.41.0" + +[author] + name = "" + homepage = "" + +# If porting an existing theme +[original] + name = "" + homepage = "" + repo = ""