From c3ef78605d8950a0ff52a92f86067dc5c42deda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sat, 27 Jan 2024 16:42:47 +0200 Subject: [PATCH] starting the blog --- .gitignore | 2 + blog/archetypes/default.md | 6 ++ blog/assets/style.css | 1 + blog/config.yaml | 27 ++++++ blog/content/log/2024/first-post-here.md | 7 ++ blog/debugconfig.yaml | 1 + blog/layouts/shortcodes/div-clear.html | 1 + blog/layouts/shortcodes/img.html | 90 +++++++++++++++++++ blog/themes/default/LICENSE | 21 +++++ blog/themes/default/README.md | 25 ++++++ .../default/layouts/_default/baseof.html | 46 ++++++++++ .../themes/default/layouts/_default/list.html | 14 +++ .../default/layouts/_default/section.html | 17 ++++ .../default/layouts/_default/single.html | 41 +++++++++ blog/themes/default/layouts/index.html | 14 +++ .../default/layouts/partials/html-meta.html | 15 ++++ .../default/layouts/shortcodes/permalink.html | 1 + blog/themes/default/theme.toml | 12 +++ flake.nix | 2 + 19 files changed, 343 insertions(+) create mode 100644 blog/archetypes/default.md create mode 120000 blog/assets/style.css create mode 100644 blog/config.yaml create mode 100644 blog/content/log/2024/first-post-here.md create mode 100644 blog/debugconfig.yaml create mode 100644 blog/layouts/shortcodes/div-clear.html create mode 100644 blog/layouts/shortcodes/img.html create mode 100644 blog/themes/default/LICENSE create mode 100644 blog/themes/default/README.md create mode 100644 blog/themes/default/layouts/_default/baseof.html create mode 100644 blog/themes/default/layouts/_default/list.html create mode 100644 blog/themes/default/layouts/_default/section.html create mode 100644 blog/themes/default/layouts/_default/single.html create mode 100644 blog/themes/default/layouts/index.html create mode 100644 blog/themes/default/layouts/partials/html-meta.html create mode 100644 blog/themes/default/layouts/shortcodes/permalink.html create mode 100644 blog/themes/default/theme.toml diff --git a/.gitignore b/.gitignore index 5d7c419..37912fe 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ vm.qcow2 __pycache__ /.pre-commit-config.yaml result + +.hugo_build.lock diff --git a/blog/archetypes/default.md b/blog/archetypes/default.md new file mode 100644 index 0000000..00e77bd --- /dev/null +++ b/blog/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true +--- + diff --git a/blog/assets/style.css b/blog/assets/style.css new file mode 120000 index 0000000..b002e9c --- /dev/null +++ b/blog/assets/style.css @@ -0,0 +1 @@ +../../static/style.css \ No newline at end of file diff --git a/blog/config.yaml b/blog/config.yaml new file mode 100644 index 0000000..a606a84 --- /dev/null +++ b/blog/config.yaml @@ -0,0 +1,27 @@ +baseURL: 'https://11sync.net/blog/' +languageCode: en-us +title: 11sync.net blog +theme: default +author: Motiejus Jakštys +Menus: + main: + - Name: Sign Up + URL: / + - Name: Blog + URL: /blog/ + - Name: Contact + URL: /contact/ +permalinks: + log: '/:year/:slug/' +Params: + dateFormat: '2006-01-02' +outputs: + home: + - HTML + - RSS +disableKinds: [taxonomy, term] +paginate: 99 +outputFormats: + RSS: + mediatype: "application/rss" + baseName: "rss" diff --git a/blog/content/log/2024/first-post-here.md b/blog/content/log/2024/first-post-here.md new file mode 100644 index 0000000..6a8db6b --- /dev/null +++ b/blog/content/log/2024/first-post-here.md @@ -0,0 +1,7 @@ +--- +title: "First Post Here" +date: 2024-01-27T12:00:36+02:00 +description: "Starting with hugo" +--- + +This company needs a blog. It will have it. diff --git a/blog/debugconfig.yaml b/blog/debugconfig.yaml new file mode 100644 index 0000000..1059357 --- /dev/null +++ b/blog/debugconfig.yaml @@ -0,0 +1 @@ +relativeURLs: true diff --git a/blog/layouts/shortcodes/div-clear.html b/blog/layouts/shortcodes/div-clear.html new file mode 100644 index 0000000..ce92d4e --- /dev/null +++ b/blog/layouts/shortcodes/div-clear.html @@ -0,0 +1 @@ +
diff --git a/blog/layouts/shortcodes/img.html b/blog/layouts/shortcodes/img.html new file mode 100644 index 0000000..469e4ad --- /dev/null +++ b/blog/layouts/shortcodes/img.html @@ -0,0 +1,90 @@ + + + +{{ $src := resources.GetMatch (.Get "src") | resources.Fingerprint }} +{{ $jmax := $src | resources.Fingerprint }} +{{ $j350 := $src.Resize "350x" }} +{{ $j700 := $src.Resize "700x" }} +{{ $j1400 := $src.Resize "1400x" }} +{{ $j2800 := $src.Resize "2800x" }} + +{{ $width := cond (eq (.Get "half") "true") "350px" "700px" }} + +{{ with .Get "hint" }} +{{ else }} + {{ errorf "missing value for param 'hint': %s" .Position }} +{{ end }} +{{ $hint := .Get "hint" }} +{{ $wmax := $src.Resize (printf "%dx%d webp" $src.Width $src.Height) }} +{{ $w350 := $src.Resize (print "350x webp " $hint ) }} +{{ $w700 := $src.Resize (print "700x webp " $hint ) }} +{{ $w1400 := $src.Resize (print "1400x webp " $hint ) }} +{{ $w2800 := $src.Resize (print "2800x webp " $hint ) }} + +
+ {{ with .Get "link" }}{{ end }} + + + + + {{ if .Get "link" }}{{ end }} + {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }} +
{{ if isset .Params "title" }} +

{{ .Get "title" }}

{{ end }} + {{ if or (.Get "caption") (.Get "attr") }}

+ {{ .Get "caption" }} + {{ with .Get "attrlink" }} {{ end }} + {{ .Get "attr" }} + {{ if .Get "attrlink" }} {{ end }} +

{{ end }} +
+ {{ end }} +
+ diff --git a/blog/themes/default/LICENSE b/blog/themes/default/LICENSE new file mode 100644 index 0000000..0b87547 --- /dev/null +++ b/blog/themes/default/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Linlin Yan + +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/blog/themes/default/README.md b/blog/themes/default/README.md new file mode 100644 index 0000000..3b6ddfb --- /dev/null +++ b/blog/themes/default/README.md @@ -0,0 +1,25 @@ +# Simple Style Hugo Theme + +My simple style hugo theme, based on [this webpage template](https://yanlinlin82.github.io/webpage-templates/simple-style/index.html) + +Online demo of this theme: [simple-style-demo](https://yanlinlin82.github.io/simple-style-demo/) + +## Supported Parameters + +In `config.toml` + +``` +[params] +subtitle = "Sub title of the site" +favicon = "//logo.ico" +githubUrl = "https://github.com///" +referrer = "always" +author = "..." +description = "..." +keywords = "..." +googleSiteVerification = "" +search = "..." # baidu, google, bing, duckduckgo +dateFormat = "Mon Jan 2 15:04:05 MST 2006" # see: https://gohugo.io/functions/format/#gos-layout-string +externalLinkIcon = true +externalLinkNewWindow = true +``` diff --git a/blog/themes/default/layouts/_default/baseof.html b/blog/themes/default/layouts/_default/baseof.html new file mode 100644 index 0000000..57d8a74 --- /dev/null +++ b/blog/themes/default/layouts/_default/baseof.html @@ -0,0 +1,46 @@ + + + + +{{ partial "html-meta.html" . -}} + {{ if not .IsHome }}{{ .Title }} - {{ end }}{{ .Site.Title }} +{{ $css := resources.Get "style.css" }} + +{{ with .Site.Params.favicon -}} + +{{ end -}} +{{ with .OutputFormats.Get "rss" -}} + {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} +{{ end -}} + + + + + +
+ {{ with .Site.Menus.parent -}} + + {{ end -}} +
+

{{ .Site.Title }}

+ {{- if .Site.Params.subtitle }}

{{ .Site.Params.subtitle }}

{{- end }} +
+ +
+
+ {{ block "main" . }}{{- end }} +
+
+
+ + diff --git a/blog/themes/default/layouts/_default/list.html b/blog/themes/default/layouts/_default/list.html new file mode 100644 index 0000000..9c1f74f --- /dev/null +++ b/blog/themes/default/layouts/_default/list.html @@ -0,0 +1,14 @@ +{{ define "main" -}} +
+

{{ .Title }}

+
+
    + {{ range .Paginator.Pages -}} +
  • + +
    {{ .Title }}
    +
  • + {{ end -}} +
+{{ template "_internal/pagination.html" . -}} +{{ end -}} diff --git a/blog/themes/default/layouts/_default/section.html b/blog/themes/default/layouts/_default/section.html new file mode 100644 index 0000000..70d261c --- /dev/null +++ b/blog/themes/default/layouts/_default/section.html @@ -0,0 +1,17 @@ +{{ define "main" -}} +
+

{{ .Title }}

+
+
+ {{ .Content -}} +
+
    + {{ range .Paginator.Pages -}} +
  • + +
    {{ .Title }}
    +
  • + {{ end -}} +
+ +{{ end }} diff --git a/blog/themes/default/layouts/_default/single.html b/blog/themes/default/layouts/_default/single.html new file mode 100644 index 0000000..4772ced --- /dev/null +++ b/blog/themes/default/layouts/_default/single.html @@ -0,0 +1,41 @@ +{{ define "main" -}} +
+
+

{{ .Title }}

+ {{ with .Params.Subtitle -}} +

{{ . }}

+ {{ end -}} +
+ {{ if .Date -}} +
{{ .Date.Format (.Site.Params.dateFormat | default "2006-01-02 15:04") }}
+ {{ end -}} + {{ $taxo := "tags" -}} + {{ if .Param $taxo -}} +
+ {{ $data := newScratch }} + {{ range .Param $taxo -}} + {{ $name := . -}} + {{ with $.Site.GetPage (printf "/%s/%s" $taxo ($name | anchorize)) }} + {{ $data.Set "url" .Permalink }} + {{ end }} + {{ with $.Site.GetPage (printf "/%s/%s" $taxo ($name | urlize)) }} + {{ $data.Set "url" .Permalink }} + {{ end }} + + {{ end -}} +
+ {{ end -}} +
+ {{ if ne .TableOfContents "" }} + {{ .TableOfContents }} +
+ {{ .Content -}} +
+ {{ else }} +
+ {{ .Content -}} +
+ {{ end }} +
+
+{{ end -}} diff --git a/blog/themes/default/layouts/index.html b/blog/themes/default/layouts/index.html new file mode 100644 index 0000000..320109a --- /dev/null +++ b/blog/themes/default/layouts/index.html @@ -0,0 +1,14 @@ +{{ define "main" -}} +
+ {{ .Content -}} +
+
    + {{ range (.Paginate ( where .Site.RegularPages "Type" "in" site.Params.mainSections )).Pages -}} +
  • + +
    {{ .Title }}
    +
  • + {{ end -}} +
+{{ template "_internal/pagination.html" . -}} +{{ end -}} diff --git a/blog/themes/default/layouts/partials/html-meta.html b/blog/themes/default/layouts/partials/html-meta.html new file mode 100644 index 0000000..3810136 --- /dev/null +++ b/blog/themes/default/layouts/partials/html-meta.html @@ -0,0 +1,15 @@ +{{ with .Site.Params.googleSiteVerification -}} + +{{ end -}} +{{ with .Site.Params.author -}} + +{{ end -}} +{{ with .Site.Params.description -}} + +{{ end -}} +{{ with .Site.Params.keywords -}} + +{{ end -}} +{{ with .Site.Params.referrer -}} + +{{ end -}} diff --git a/blog/themes/default/layouts/shortcodes/permalink.html b/blog/themes/default/layouts/shortcodes/permalink.html new file mode 100644 index 0000000..f34aae9 --- /dev/null +++ b/blog/themes/default/layouts/shortcodes/permalink.html @@ -0,0 +1 @@ +{{with .Get 0}}{{end}} diff --git a/blog/themes/default/theme.toml b/blog/themes/default/theme.toml new file mode 100644 index 0000000..e2d29ca --- /dev/null +++ b/blog/themes/default/theme.toml @@ -0,0 +1,12 @@ +name = "Simple Style" +license = "MIT" +licenselink = "https://github.com/yanlinlin82/simple-style/blob/master/LICENSE" +description = "A simple style huho theme by Linlin Yan." +homepage = "https://github.com/yanlinlin82/simple-style/" +tags = [ "simple", "blog", "white" ] +features = [ "simple", "white" ] +min_version = "0.61.0" + +[author] +name = "Linlin Yan" +homepage = "http://yanlinlin.cn/" diff --git a/flake.nix b/flake.nix index bdb1cd3..9c4fdc5 100644 --- a/flake.nix +++ b/flake.nix @@ -101,6 +101,8 @@ ) pkgs.libmaxminddb pkgs.dart-sass + + pkgs.hugo ]; GEOIP_PATH = "${pkgs.geoip-mmdb}"; E11SYNC_DEBUG = "1";