1

starting the blog

This commit is contained in:
Motiejus Jakštys 2024-01-27 16:42:47 +02:00
parent 82434456d9
commit c3ef78605d
19 changed files with 343 additions and 0 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ vm.qcow2
__pycache__
/.pre-commit-config.yaml
result
.hugo_build.lock

View File

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

1
blog/assets/style.css Symbolic link
View File

@ -0,0 +1 @@
../../static/style.css

27
blog/config.yaml Normal file
View File

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

View File

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

1
blog/debugconfig.yaml Normal file
View File

@ -0,0 +1 @@
relativeURLs: true

View File

@ -0,0 +1 @@
<div style="clear: both"></div>

View File

@ -0,0 +1,90 @@
<!--
# Responsive images and resizing
Our picture width is 700 css pixels. "Retina" screens have 2 device pixel ratio
(dpr), crazy folks have 4. So the maximum width of the picture we can possibly
care about is 700*4=2800px.
-->
<!-- image -->
{{ $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 ) }}
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<picture>
<source type="image/webp"
sizes="(max-width: 600px) 350px, {{ $width }}"
{{- if eq $hint "graph" }}
srcset='{{ $wmax.RelPermalink}} {{ $wmax.Width}}w'
{{- else }}
srcset='
{{- if ge $src.Width "350" }}
{{ with $w350.RelPermalink }}{{.}} 350w{{ end }}
{{- end }}
{{- if ge $src.Width "700" }}
{{ with $w700.RelPermalink }}, {{.}} 700w{{ end }}
{{- end }}
{{- if ge $src.Width "1400" }}
{{ with $w1400.RelPermalink }}, {{.}} 1400w{{ end }}
{{- end }}
{{- if ge $src.Width "2800" }}
{{ with $w2800.RelPermalink }}, {{.}} 2800w{{ end }}
{{- end }}'
{{- end }}
/>
<img
sizes="(max-width: 600px) 350px, 700px"
{{- if eq $hint "graph" }}
srcset='{{ $jmax.RelPermalink}} {{ $jmax.Width}}w'
{{- else }}
srcset='
{{- if ge $src.Width "350" }}
{{ with $j350.RelPermalink }}{{.}} 350w{{ end }}
{{- end }}
{{- if ge $src.Width "700" }}
{{ with $j700.RelPermalink }}, {{.}} 700w{{ end }}
{{- end }}
{{- if ge $src.Width "1400" }}
{{ with $j1400.RelPermalink }}, {{.}} 1400w{{ end }}
{{- end }}
{{- if ge $src.Width "2800" }}
{{ with $j2800.RelPermalink }}, {{.}} 2800w{{ end }}
{{- end }}'
{{- end }}
src="{{ $j700.RelPermalink }}"
{{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }}
/>
</picture>
{{ if .Get "link" }}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
<figcaption>{{ if isset .Params "title" }}
<h4>{{ .Get "title" }}</h4>{{ end }}
{{ if or (.Get "caption") (.Get "attr") }}<p>
{{ .Get "caption" }}
{{ with .Get "attrlink" }}<a href="{{ . }}"> {{ end }}
{{ .Get "attr" }}
{{ if .Get "attrlink" }}</a> {{ end }}
</p> {{ end }}
</figcaption>
{{ end }}
</figure>
<!-- image -->

View File

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

View File

@ -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 = "/<path-to-site-icon>/logo.ico"
githubUrl = "https://github.com/<your-name>/<site-proj-name>/"
referrer = "always"
author = "..."
description = "..."
keywords = "..."
googleSiteVerification = "<google-site-verification-code>"
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
```

View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
{{ partial "html-meta.html" . -}}
<title>{{ if not .IsHome }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
{{ $css := resources.Get "style.css" }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
{{ with .Site.Params.favicon -}}
<link rel="shortcut icon" href="{{ . }}" type="image/x-icon">
{{ end -}}
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
{{ end -}}
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description"
content="{{ if .Params.description }}{{ .Params.description }}{{ else }}11sync.net blog{{ end }}"
/>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
</head>
<body>
<header>
{{ with .Site.Menus.parent -}}
<nav>
{{ range . -}}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end -}}
</nav>
{{ end -}}
<div>
<h1><a href="/">{{ .Site.Title }}</a></h1>
{{- if .Site.Params.subtitle }}<h2><a href="{{ .Site.BaseURL }}">{{ .Site.Params.subtitle }}</a></h2>{{- end }}
</div>
<nav>
{{- range .Site.Menus.main -}}
<a href="{{ .URL }}">{{ .Name }}</a>
{{- end -}}
</nav>
</header>
<main>
{{ block "main" . }}{{- end }}
</main>
<footer>
</footer>
</body>
</html>

View File

@ -0,0 +1,14 @@
{{ define "main" -}}
<div>
<h1>{{ .Title }}</h1>
</div>
<ul class="article-list">
{{ range .Paginator.Pages -}}
<li class="article-item">
<div class="article-date">{{ .Date.Format (.Site.Params.dateFormat | default "2006-01-02 15:04") }}</div>
<div class="article-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></div>
</li>
{{ end -}}
</ul>
{{ template "_internal/pagination.html" . -}}
{{ end -}}

View File

@ -0,0 +1,17 @@
{{ define "main" -}}
<div>
<h1>{{ .Title }}</h1>
</div>
<div>
{{ .Content -}}
</div>
<ul class="article-list">
{{ range .Paginator.Pages -}}
<li class="article-item">
<div class="article-date">{{ .Date.Format (.Site.Params.dateFormat | default "2006-01-02 15:04") }}</div>
<div class="article-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></div>
</li>
{{ end -}}
</ul>
</main>
{{ end }}

View File

@ -0,0 +1,41 @@
{{ define "main" -}}
<article>
<div class="title">
<h1>{{ .Title }}</h1>
{{ with .Params.Subtitle -}}
<h2>{{ . }}</h2>
{{ end -}}
</div>
{{ if .Date -}}
<div class="meta">{{ .Date.Format (.Site.Params.dateFormat | default "2006-01-02 15:04") }}</div>
{{ end -}}
{{ $taxo := "tags" -}}
{{ if .Param $taxo -}}
<div class="meta">
{{ $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 }}
<div class="tag"><a href="{{ $data.Get "url" }}">#{{ $name }}</a></div>
{{ end -}}
</div>
{{ end -}}
<div class="artical-body">
{{ if ne .TableOfContents "<nav id=\"TableOfContents\"></nav>" }}
{{ .TableOfContents }}
<div class="content-with-toc">
{{ .Content -}}
</div>
{{ else }}
<div class="content">
{{ .Content -}}
</div>
{{ end }}
</div>
</article>
{{ end -}}

View File

@ -0,0 +1,14 @@
{{ define "main" -}}
<div>
{{ .Content -}}
</div>
<ul class="article-list">
{{ range (.Paginate ( where .Site.RegularPages "Type" "in" site.Params.mainSections )).Pages -}}
<li class="article-item">
<div class="article-date">{{ .Date.Format (.Site.Params.dateFormat | default "2006-01-02 15:04") }}</div>
<div class="article-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></div>
</li>
{{ end -}}
</ul>
{{ template "_internal/pagination.html" . -}}
{{ end -}}

View File

@ -0,0 +1,15 @@
{{ with .Site.Params.googleSiteVerification -}}
<meta name="google-site-verification" content="{{ . }}">
{{ end -}}
{{ with .Site.Params.author -}}
<meta name="author" content="{{ . }}">
{{ end -}}
{{ with .Site.Params.description -}}
<meta name="description" content="{{ . }}">
{{ end -}}
{{ with .Site.Params.keywords -}}
<meta name="keywords" content="{{ . }}">
{{ end -}}
{{ with .Site.Params.referrer -}}
<meta name="referrer" content="{{ . }}">
{{ end -}}

View File

@ -0,0 +1 @@
{{with .Get 0}}<a id="{{.}}" href="#{{.}}"><svg class="permalink" height="22px" viewBox="0 0 24 24" width="22px" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"></path><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></svg></a>{{end}}

View File

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

View File

@ -101,6 +101,8 @@
)
pkgs.libmaxminddb
pkgs.dart-sass
pkgs.hugo
];
GEOIP_PATH = "${pkgs.geoip-mmdb}";
E11SYNC_DEBUG = "1";