Switch to Hugo-based build

This commit is contained in:
Antoine Martin 2022-11-18 23:26:44 +01:00
parent 21feddaf52
commit 10b809eebd
18 changed files with 257 additions and 0 deletions

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
/.direnv/
/.envrc
/public/
/.hugo_build.lock
/resources/_gen/
/result

6
archetypes/default.md Normal file
View file

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

5
config.toml Normal file
View file

@ -0,0 +1,5 @@
baseURL = 'https://antoinemartin.fr/'
languageCode = 'en-us'
title = 'Antoine Martin - Computer Person'
theme = 'custom'
enableRobotsTXT = true

5
content/_index.md Normal file
View file

@ -0,0 +1,5 @@
# Antoine Martin
Computer Scientist in training.
WIP.

43
flake.lock Normal file
View file

@ -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
}

50
flake.nix Normal file
View file

@ -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
];
};
}
));
}

20
themes/custom/LICENSE Normal file
View file

@ -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.

View file

@ -0,0 +1,2 @@
+++
+++

View file

@ -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;
}
}

View file

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
<body>
{{- partial "header.html" . -}}
<div id="content">
{{- block "main" . }}{{- end }}
</div>
{{- partial "footer.html" . -}}
</body>
</html>

View file

View file

@ -0,0 +1,19 @@
{{ define "main" }}
<main aria-role="main">
<header class="homepage-header">
<h1>{{.Title}}</h1>
{{ with .Params.subtitle }}
<span class="subtitle">{{.}}</span>
{{ end }}
</header>
<div class="homepage-content">
<!-- Note that the content for index.html, as a sort of list page, will pull from content/_index.md -->
{{.Content}}
</div>
<div>
{{ range first 10 .Site.RegularPages }}
{{ .Render "summary"}}
{{ end }}
</div>
</main>
{{ end }}

View file

@ -0,0 +1,7 @@
<head>
<meta charset="utf-8">
{{ $sassOptions := (dict "targetPath" "style.css" "enableSourceMap" (not hugo.IsProduction)) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $sassOptions }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" type="text/css">
</head>

21
themes/custom/theme.toml Normal file
View file

@ -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 = ""