feat(layouts): add baseof.html layout template

This commit adds a new layout template called baseof.html. This template is used as the base layout for all other templates in the project. It includes the basic HTML structure, meta tags, and a placeholder for the main content.

The purpose of this change is to provide a consistent and reusable base layout for all pages in the project, reducing code duplication and improving maintainability.

---

feat(layouts): add single.html layout template

This commit adds a new layout template called single.html. This template is used for rendering individual content pages. It includes a block for the main content and some additional logic for handling the current menu item and generating image JSON.

The purpose of this change is to provide a specific layout for individual content pages, allowing for customization and flexibility in their presentation.

---

refactor(layouts): remove index.html layout template and related partials

This commit removes the index.html layout template and its associated partials (footer.html, head.html, link.html, meta.html, seo.html, mobile_wrapper.html, and nav.html).

The index.html layout template was no longer needed as the project has transitioned to using the baseof.html and single.html templates for rendering pages. The associated partials were also no longer used and can be safely removed.

The purpose of this change is to clean up unused code and reduce clutter in the project.
This commit is contained in:
Sped0n
2023-10-30 15:56:43 +08:00
parent 40f278ce1c
commit 0b350db741
10 changed files with 71 additions and 89 deletions

View File

@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ .Title }}</title>
{{- partial "head/link.html" -}}
{{- partial "head/meta.html" -}}
{{- partial "head/seo.html" -}}
</head>
<body>
<div id="main">
{{- block "main" . -}}
{{- end -}}
</div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
{{- define "main" -}}
{{- $params := .Scratch.Get "params" -}}
{{- $currentPage := . -}}
{{- with partial "function/currentMenuItem.html" . -}}
{{- partial "resources/imageJSON.html" (dict "Path" .Name "Page" $currentPage) -}}
<script>document.getElementById("main").setAttribute("currentMenuItemIndex", "{{- (sub .ID 1) -}}")</script>
{{- end -}}
<div class="container">
{{- partial "nav.html" . -}}
</div>
<article class="info">
{{ .Content }}
</article>
{{- end -}}

View File

@@ -1,42 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{ partial "head.html" . }}
<title>{{ .Title }}</title>
</head>
<body>
<header>
{{ partial "header.html" . }}
</header>
<div id="main">
{{ $sourcePath := "images" }}
{{ $gallery := site.GetPage $sourcePath }}
{{ with $gallery.Resources.ByType "image" }}
{{ $index := len . }}
{{ $.Scratch.Add "img" slice }}
{{ range . }}
{{ $index = sub $index 1 }}
{{ $colors := .Colors }}
{{ $pColor := index $colors 0 }}
{{ $sColor := "#ccc" }}
{{ if gt (len $colors) 1 }}
{{ $sColor = index $colors 1 }}
{{ end }}
{{ $resize := .Resize "x2000 webp Lanczos q70" }}
{{ $.Scratch.Add "img" (dict
"index" (int $index)
"url" (string .RelPermalink)
"imgH" (int .Height)
"imgW" (int .Width)
"pColor" (string $pColor)
"sColor" (string $sColor))
}}
{{ end }}
<script id="imagesSource" type="application/json">{{ $.Scratch.Get "img" | jsonify | safeJS }}</script>
{{ end }}
</div>
<div class="container">{{ partial "nav.html" . }}</div>
</body>
</html>

View File

@@ -1,24 +0,0 @@
<div class="footer_name">spedon</div>
<div class="footer_categoryWrapper">
<span class="footer_category">Featured</span>
<span class="footer_category">iPhone</span>
<span class="footer_category">Film</span>
<span class="footer_category">Info</span>
</div>
<div class="footer_threshold">
Threshold:
<button id="thresholdDec">-</button>
<span class="thid"></span>
<button id="thresholdInc">+</button>
</div>
<div class="footer_imageIndex">
<span class="ftid"></span>
<span class="ftid"></span>
<span class="ftid"></span>
<span class="ftid"></span>
<span>&nbsp;/</span>
<span class="ftid"></span>
<span class="ftid"></span>
<span class="ftid"></span>
<span class="ftid"></span>
</div>

View File

@@ -1,13 +0,0 @@
{{- $fingerprint := .Scratch.Get "fingerprint" | default "" -}}
{{- $style := dict "Source" "scss/style.scss" "Fingerprint" $fingerprint -}}
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
{{- $style = dict "Context" . "ToCSS" $options | merge $style -}}
{{- partial "plugin/style.html" $style -}}
{{- $esBuildOpts := dict "minify" hugo.IsProduction -}}
{{- $script := resources.Get "ts/main.ts" | js.Build $esBuildOpts -}}
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"
/>
<script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script>

View File

@@ -0,0 +1,27 @@
{{/* fingerprint */}}
{{- $fingerprint := .Scratch.Get "fingerprint" | default "" -}}
{{/* main style */}}
{{- $style := dict "Source" "scss/style.scss" "Fingerprint" $fingerprint -}}
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
{{- $style = dict "Context" . "ToCSS" $options | merge $style -}}
{{- partial "plugin/style.html" $style -}}
{{/* swiper css */}}
{{- $style := dict "Source" "/lib/swiper/swiper-bundle.min.css" "Fingerprint" $fingerprint -}}
{{- partial "plugin/style.html" $style -}}
{{/* main js */}}
{{- $esBuildOpts := dict "minify" hugo.IsProduction -}}
{{- $js := resources.Get "ts/main.ts" | js.Build $esBuildOpts -}}
{{- $script := dict "Source" $js.Permalink "Fingerprint" $fingerprint "Defer" true -}}
{{- partial "plugin/script.html" $script -}}
{{/* fonts */}}
<link
rel="preload"
href="/lib/fonts/HelveticaNowText-Regular.woff2"
as="font"
type="font/woff2"
crossorigin
/>

View File

@@ -0,0 +1 @@

View File

@@ -1,6 +0,0 @@
<div class='mobileWrapper'>
{{ $sourcePath := "images" }}
{{ $gallery := site.GetPage $sourcePath }}
{{ with $gallery.Resources.ByType "image" }}
{{ end }}
</div>

View File

@@ -3,10 +3,18 @@
<a href="/">Bridget Baker</a>
</div>
<div class="links">
<span class="link">Featured</span>
<span class="link">iPhone</span>
<span class="link">Film</span>
<span class="link">Info</span>
{{- $index := 0 -}}
{{- $menus := .Site.Menus.main -}}
{{- $len := len $menus }}
{{- range $menus -}}
{{- $url := .URL | relLangURL -}}
{{- if eq (add $index 1) $len -}}
<a href="{{- .URL | relLangURL -}}" class="link">{{- .Identifier -}}</a>
{{- else -}}
<a href="{{- .URL | relLangURL -}}" class="link">{{- .Identifier -}}</a>,&nbsp
{{- end -}}
{{- $index = add $index 1 -}}
{{- end -}}
</div>
<div class="threshold">
<span>Threshold:</span>