summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorFrancesco <tomaselli.fr@gmail.com>2024-04-22 13:19:56 +0200
committerFrancesco <tomaselli.fr@gmail.com>2024-04-22 13:19:56 +0200
commit7b4b78ee8458b16a6167170bf7405d7bf911cfbc (patch)
tree96e756a5e36793bf50d26759e58c0467cc81e096 /layouts
parentfe32c5cc878b8f2608cb58057b3c0cab49488a2f (diff)
Initial
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html31
-rw-r--r--layouts/_default/home.html58
-rw-r--r--layouts/_default/list.html18
-rw-r--r--layouts/_default/single.html45
-rw-r--r--layouts/partials/footer.html5
-rw-r--r--layouts/partials/head.html10
-rw-r--r--layouts/partials/head/css.html11
-rw-r--r--layouts/partials/head/js.html12
-rw-r--r--layouts/partials/header.html20
-rw-r--r--layouts/partials/math.html9
-rw-r--r--layouts/partials/pagination-controls.html23
-rw-r--r--layouts/partials/post-entry.html4
12 files changed, 246 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
new file mode 100644
index 0000000..eef7b25
--- /dev/null
+++ b/layouts/_default/baseof.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="{{ or site.Language.LanguageCode site.Language.Lang }}"
+ dir="{{ or site.Language.LanguageDirection `ltr` }}">
+
+<head>
+ {{ partial "head.html" . }}
+ {{ if .Param "math" }}
+ {{ partialCached "math.html" . }}
+ {{ end }}
+</head>
+
+<body>
+
+ <div class="content">
+ <header>
+ {{ partial "header.html" . }}
+ </header>
+
+ <main class="main">
+ {{ block "main" . }}{{ end }}
+ </main>
+ </div>
+
+ <footer>
+ {{ partial "footer.html" . }}
+ </footer>
+
+</body>
+
+
+</html> \ No newline at end of file
diff --git a/layouts/_default/home.html b/layouts/_default/home.html
new file mode 100644
index 0000000..bc3aad8
--- /dev/null
+++ b/layouts/_default/home.html
@@ -0,0 +1,58 @@
+{{ define "main" }}
+
+{{ .Content }}
+
+{{/* Intro summary section */}}
+{{ if .Site.Params.homeIntro }}
+
+<div class="intro">
+ {{ if .Site.Params.homeIntroTitle }}
+ <h1>{{ .Site.Params.homeIntroTitle }}</h1>
+ {{ end }}
+
+ {{ if .Site.Params.homeIntroContent }}
+ <p>{{ .Site.Params.homeIntroContent | markdownify }}</p>
+ {{ end }}
+</div>
+
+{{ end }}
+
+{{/* Social Icons */}}
+
+{{ with site.Params.social }}
+<div class="social-icons">
+ {{- range . }}
+ <a href="{{ trim .url " " | safeURL }}" target="_blank" rel="noopener noreferrer me"
+ title="{{ (.title | default .name) | title }}">
+ {{ partial "svg.html" . }}
+ </a>
+ {{- end }}
+</div>
+{{ end }}
+
+{{/* Collection Section */}}
+
+{{ if .Site.Params.homeCollection }}
+
+{{ with .Site.Params.homeCollectionTitle}}
+<h1> {{ . }} </h1>
+{{ end }}
+
+{{ $pages := where .Site.RegularPages "Section" .Site.Params.homeCollection }}
+
+{{ $paginationSize := 1}}
+{{ if (gt .Site.Params.paginationSize 0) }}
+{{ $paginationSize = .Site.Params.paginationSize }}
+{{ end }}
+
+{{ $paginator := .Paginate $pages $paginationSize }}
+
+{{ range $index, $page := $paginator.Pages }}
+{{ partial "post-entry.html" $page}}
+{{ end }}
+
+{{ partial "pagination-controls.html" $paginator}}
+
+{{ end }}
+
+{{ end }} \ No newline at end of file
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
new file mode 100644
index 0000000..8c52a86
--- /dev/null
+++ b/layouts/_default/list.html
@@ -0,0 +1,18 @@
+{{ define "main" }}
+<h1>{{ .Title }}</h1>
+{{ .Content }}
+
+{{ $paginationSize := 1}}
+{{ if (gt .Site.Params.paginationSize 0) }}
+{{ $paginationSize = .Site.Params.paginationSize }}
+{{ end }}
+
+{{ $paginator := .Paginate (.Pages) $paginationSize }}
+
+{{ range $index, $page := $paginator.Pages }}
+{{ partial "post-entry.html" $page}}
+{{ end }}
+
+{{ partial "pagination-controls.html" $paginator}}
+
+{{ end }} \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
new file mode 100644
index 0000000..b68da6c
--- /dev/null
+++ b/layouts/_default/single.html
@@ -0,0 +1,45 @@
+{{ define "main" }}
+
+{{/* Intro */}}
+
+<div class="single-intro-container">
+
+ {{/* Title and Summary */}}
+
+ <h1 class="single-title">{{ .Title }}</h1>
+ {{if .Param "summary" }}
+ <p class="single-summary">{{ .Summary }}</p>
+ {{ end }}
+
+ {{/* Reading Time */}}
+
+ <p class="single-readtime">
+ {{if .Date }}
+ {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
+ {{ $dateHuman := .Date | time.Format ":date_long" }}
+ <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
+ -
+ {{end}}
+ {{if (.Param "readTime")}}
+ {{.ReadingTime}} min
+ {{end }}
+ </p>
+
+</div>
+
+{{/* Table of Content */}}
+
+{{if .Param "toc" }}
+<aside class="toc">
+ <p><strong>Table of contents</strong></p>
+ {{ .TableOfContents }}
+</aside>
+{{ end }}
+
+{{/* Actual document content */}}
+
+<div class="single-content">
+ {{ .Content }}
+</div>
+
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
new file mode 100644
index 0000000..65f97aa
--- /dev/null
+++ b/layouts/partials/footer.html
@@ -0,0 +1,5 @@
+<p>Powered by
+ <a href="https://gohugo.io/">Hugo</a>
+ {{/* and
+ <a href="https://github.com/tomfran/typo">tomfran/typo</a> */}}
+</p> \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
new file mode 100644
index 0000000..a16d7ea
--- /dev/null
+++ b/layouts/partials/head.html
@@ -0,0 +1,10 @@
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width">
+<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
+{{ partialCached "head/css.html" . }}
+{{ partialCached "head/js.html" . }}
+
+
+{{ if hugo.IsProduction }}
+{{ template "_internal/google_analytics.html" . }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html
new file mode 100644
index 0000000..abca3b8
--- /dev/null
+++ b/layouts/partials/head/css.html
@@ -0,0 +1,11 @@
+{{- $CSS := slice
+(resources.Get "css/reset.css")
+(resources.Get "css/vars.css")
+(resources.Get "css/utils.css")
+(resources.Get "css/fonts.css")
+(resources.Get "css/main.css") |
+resources.Concat "assets/combined.css" |
+minify |
+fingerprint }}
+
+<link rel="stylesheet" href="{{ $CSS.RelPermalink }}" media="all"> \ No newline at end of file
diff --git a/layouts/partials/head/js.html b/layouts/partials/head/js.html
new file mode 100644
index 0000000..18fe842
--- /dev/null
+++ b/layouts/partials/head/js.html
@@ -0,0 +1,12 @@
+{{- with resources.Get "js/main.js" }}
+ {{- if eq hugo.Environment "development" }}
+ {{- with . | js.Build }}
+ <script src="{{ .RelPermalink }}"></script>
+ {{- end }}
+ {{- else }}
+ {{- $opts := dict "minify" true }}
+ {{- with . | js.Build $opts | fingerprint }}
+ <script src="{{ .RelPermalink }}" integrity="{{- .Data.Integrity }}" crossorigin="anonymous"></script>
+ {{- end }}
+ {{- end }}
+{{- end }}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644
index 0000000..92da9a7
--- /dev/null
+++ b/layouts/partials/header.html
@@ -0,0 +1,20 @@
+{{/* Header */}}
+
+<div class="header">
+ <h1>{{ site.Title }}</h1>
+
+ <div class="flex">
+ {{ $currentPage := . }}
+
+ {{ with site.Params.menu }}
+ {{ range . }}
+ <p class="small {{ if eq .url $currentPage.Path }} bold {{end}}">
+ <a href="{{.url}}">
+ /{{.name }}
+ </a>
+ </p>
+ {{ end }}
+ {{ end }}
+
+ </div>
+</div> \ No newline at end of file
diff --git a/layouts/partials/math.html b/layouts/partials/math.html
new file mode 100644
index 0000000..59a0b2d
--- /dev/null
+++ b/layouts/partials/math.html
@@ -0,0 +1,9 @@
+<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
+<script>
+ MathJax = {
+ tex: {
+ displayMath: [['\\[', '\\]'], ['$$', '$$']],
+ inlineMath: [['\\[', '\\]'], ['$', '$']]
+ }
+ };
+</script> \ No newline at end of file
diff --git a/layouts/partials/pagination-controls.html b/layouts/partials/pagination-controls.html
new file mode 100644
index 0000000..b26d609
--- /dev/null
+++ b/layouts/partials/pagination-controls.html
@@ -0,0 +1,23 @@
+{{ if gt .TotalPages 1 }}
+<div class="pagination">
+ <div class="pagination-control">
+ {{ if .HasPrev }}
+ <a href="{{ .Prev.URL | absURL }}">
+ prev
+ </a>
+ {{ end }}
+ </div>
+ <div class="page-number">
+ <p>
+ {{ .PageNumber }}/{{ .TotalPages }}
+ </p>
+ </div>
+ <div class="pagination-control">
+ {{ if .HasNext }}
+ <a href="{{ .Next.URL | absURL }}">
+ next
+ </a>
+ {{ end }}
+ </div>
+</div>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/post-entry.html b/layouts/partials/post-entry.html
new file mode 100644
index 0000000..f3f2a23
--- /dev/null
+++ b/layouts/partials/post-entry.html
@@ -0,0 +1,4 @@
+<div class="post-line">
+ <p class="post-date">{{ .Date.Format "2 Jan 2006" }} </p>
+ <p class="post-title"> <a href="{{ .RelPermalink }}">{{ .Title }}</a></p>
+</div> \ No newline at end of file