From e2f739c9e19f57b72b599eaf5bfc10265e62ddb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 15:22:18 +0200 Subject: feat(style): change tag to now --- main.go | 10 +++++----- scss/main.scss | 3 +++ scss/tag.scss | 6 ------ templates/base/base.gohtml | 5 +++-- templates/page/index.gohtml | 2 +- templates/page/now.gohtml | 19 +++++++++++++++++++ templates/page/tags.gohtml | 18 ------------------ 7 files changed, 31 insertions(+), 32 deletions(-) create mode 100644 templates/page/now.gohtml delete mode 100644 templates/page/tags.gohtml diff --git a/main.go b/main.go index 7fd7093..22ff486 100644 --- a/main.go +++ b/main.go @@ -117,14 +117,14 @@ func main() { "/legal", "Legal things", "", - "Legal information about "+cfg.Person.Name+"'s Now page", + "Legal information about "+cfg.Person.Name+"'s bio", &cfg, ).Handle() - g.NewTemplate("tags", - "/tags", - "Tags", + g.NewTemplate("now", + "/now", + "Now", "", - "Tags of "+cfg.Person.Name+"'s Now page", + ""+cfg.Person.Name+"'s now", &cfg, ).Handle() diff --git a/scss/main.scss b/scss/main.scss index 8723941..adb87be 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -92,6 +92,7 @@ main { h1, h2, h3 { margin-bottom: 1rem; margin-top: 2rem; + font-weight: bold; } p { @@ -116,6 +117,7 @@ h3 { h4 { font-size: 1.25rem; + font-weight: bold; } ul, ol { @@ -224,6 +226,7 @@ em { width: 100%; column-gap: 1rem; row-gap: 0.5rem; + justify-items: center; @media only screen and (max-width: vars.$bp-little) { grid-template-columns: 1fr; column-gap: 0.5rem; diff --git a/scss/tag.scss b/scss/tag.scss index 5134f27..10fc161 100644 --- a/scss/tag.scss +++ b/scss/tag.scss @@ -37,10 +37,4 @@ display: block; } } - &:hover { - background: var(--tag-hover); - & h4 { - font-weight: bold; - } - } } diff --git a/templates/base/base.gohtml b/templates/base/base.gohtml index 34d5451..894685b 100644 --- a/templates/base/base.gohtml +++ b/templates/base/base.gohtml @@ -1,4 +1,5 @@ {{define "base"}} + {{ $notRoot := ne .SEO.URL "/" }} @@ -20,7 +21,7 @@ {{template "opengraph-base" .SEO}} - {{ if .Data.IsCustomPage }} + {{ if $notRoot }} @@ -36,7 +37,7 @@ {{ $rings := getRings }} {{ if ne $rings nil }} -
+ {{ end }} diff --git a/templates/page/now.gohtml b/templates/page/now.gohtml new file mode 100644 index 0000000..776e87a --- /dev/null +++ b/templates/page/now.gohtml @@ -0,0 +1,19 @@ +{{define "body"}} +
+
+

Now

+ +
+
+ {{ range $tag := .Person.Tags }} +
+

{{ .Name }}

+

{{ .Description }}

+

Hello

+
+ {{ end }} +
+
+{{end}} \ No newline at end of file diff --git a/templates/page/tags.gohtml b/templates/page/tags.gohtml deleted file mode 100644 index 6106152..0000000 --- a/templates/page/tags.gohtml +++ /dev/null @@ -1,18 +0,0 @@ -{{define "body"}} -
-
-

Tags

- -
-
- {{ range $tag := .Person.Tags }} -
-

{{ .Name }}

-

{{ .Description }}

-
- {{ end }} -
-
-{{end}} \ No newline at end of file -- cgit v1.2.3 From 36963a2839b33121de235c5e16743e508a52b9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 15:32:45 +0200 Subject: feat(now): modify how links are handled --- data.go | 1 + index.ts | 9 --------- main.go | 4 ++-- scss/tag.scss | 1 - templates/page/now.gohtml | 6 ++++-- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/data.go b/data.go index fccaec3..e250d78 100644 --- a/data.go +++ b/data.go @@ -55,6 +55,7 @@ type Tag struct { Name string `json:"name" toml:"name"` Description string `json:"description" toml:"description"` Link string `json:"link" toml:"link"` + LinkName string `json:"link_name" toml:"link_name"` } type Color struct { diff --git a/index.ts b/index.ts index e48401f..68b6f19 100644 --- a/index.ts +++ b/index.ts @@ -1,13 +1,4 @@ function setupEvents() { - document.querySelectorAll(".tag")?.forEach(t => { - t.addEventListener("click", _ => { - const link = t.getAttribute("data-href") - if (link === null || link === "") return - if (!link.startsWith(window.location.origin) && link.startsWith("https://")) window.open(link) - else changePage(link) - }) - }) - document.querySelectorAll("a")?.forEach(a => { a.addEventListener("click", e => { if (!a.href.startsWith(window.location.origin)) return diff --git a/main.go b/main.go index 22ff486..7f967ff 100644 --- a/main.go +++ b/main.go @@ -186,8 +186,8 @@ func generateConfigFile(isToml bool) { Pronouns: "any", Image: "pfp.webp", Tags: []*Tag{ - {"Hello", "World", ""}, - {"I am", "a tag", ""}, + {"Hello", "World", "", ""}, + {"I am", "a tag", "", ""}, }, }, Color: &Color{ diff --git a/scss/tag.scss b/scss/tag.scss index 10fc161..a604380 100644 --- a/scss/tag.scss +++ b/scss/tag.scss @@ -22,7 +22,6 @@ } .tag { - cursor: pointer; padding: 0.5rem; margin: -0.5rem; border-radius: 8px; diff --git a/templates/page/now.gohtml b/templates/page/now.gohtml index 776e87a..6af668e 100644 --- a/templates/page/now.gohtml +++ b/templates/page/now.gohtml @@ -8,10 +8,12 @@
{{ range $tag := .Person.Tags }} -
+

{{ .Name }}

{{ .Description }}

-

Hello

+ {{ if and (ne .Link "") (ne .LinkName "") }} +

{{ .LinkName }}

+ {{ end }}
{{ end }}
-- cgit v1.2.3 From 7240e39c532a5a4238b5f25bd6956d54705d6806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 15:54:55 +0200 Subject: docs(info): update now usage in readme --- README.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a5d168f..ba1d137 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ You can create a sample config with the flag `-generate-json-config` (which gene The config does not depend on the markup language: a field `foo` will being named `foo` for JSON and TOML. The TOML format is used in this section. +Every path is relative to the `public` directory (except for html and config files which are relatives to the path of +the binary). +For example, `wallpaper.webp` is searched in `public/wallpaper.webp` + The root is defining the background image, the description, the file's path to the legal pages, the path to the custom font (you can remove this if you want to use `Raveo, Inter, Roboto` as default fonts), the path to the configs of custom pages and a list of all your ["rel-me"](https://microformats.org/wiki/rel-me) links. @@ -55,8 +59,7 @@ font = "" custom_pages = ["custom.toml"] rel_me_links = ["https://foo.example.org/@bar"] ``` -The path is relative to the execution of the binary, except for `image` and `font` which are relative to the `public` -folder. +The `legal` and `custom_pages` are relatives to the path of the binary. If you are using Docker, please use a static path. The first section is defining who you are. @@ -68,16 +71,21 @@ It must be placed inside the `public` directory. pronouns = "any" image = "pfp.webp" - [[person.tags]] + [[person.now]] name = "Hello" description = "World" link = "" + link_name = "" - [[person.tags]] + [[person.now]] name = "I am" description = "a tag" - link = "" + link = "https://example.org/foo/bar" + link_name = "And I have a link!" ``` +Only `person.now.description` is required. +If you omit a field, the content linked with it will not appear. +`person.now.link_name` is the link's name displayed. Then, you define the colors of the main page. `text` is the text's color. @@ -144,6 +152,7 @@ image = "wallpaper.webp" description = "I am a beautiful description!" content = "foo-bar.html" ``` +The `content` is relative to the path of the binary. Then, you can define custom colors. Check _Main config_'s colors section for more information. -- cgit v1.2.3 From fdf8c390e91ef02c05a95fa1f8c1c9104ffbabf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 15:56:18 +0200 Subject: style(now): rename tags in now --- data.go | 4 ++-- main.go | 2 +- templates/page/now.gohtml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data.go b/data.go index e250d78..174b104 100644 --- a/data.go +++ b/data.go @@ -48,10 +48,10 @@ type Person struct { Name string `json:"name" toml:"name"` Pronouns string `json:"pronouns" toml:"pronouns"` Image string `json:"image" toml:"image"` - Tags []*Tag `json:"tags" toml:"tags"` + Now []*Now `json:"now" toml:"now"` } -type Tag struct { +type Now struct { Name string `json:"name" toml:"name"` Description string `json:"description" toml:"description"` Link string `json:"link" toml:"link"` diff --git a/main.go b/main.go index 7f967ff..6df8e79 100644 --- a/main.go +++ b/main.go @@ -185,7 +185,7 @@ func generateConfigFile(isToml bool) { Name: "John Doe", Pronouns: "any", Image: "pfp.webp", - Tags: []*Tag{ + Now: []*Now{ {"Hello", "World", "", ""}, {"I am", "a tag", "", ""}, }, diff --git a/templates/page/now.gohtml b/templates/page/now.gohtml index 6af668e..5286f87 100644 --- a/templates/page/now.gohtml +++ b/templates/page/now.gohtml @@ -7,7 +7,7 @@
- {{ range $tag := .Person.Tags }} + {{ range $now := .Person.Now }}

{{ .Name }}

{{ .Description }}

-- cgit v1.2.3 From f9464729d0775341a5bec5a0ae38bea1ad64bded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 15:58:21 +0200 Subject: feat(now): do not display title if field is empty --- templates/page/now.gohtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/page/now.gohtml b/templates/page/now.gohtml index 5286f87..96c8b77 100644 --- a/templates/page/now.gohtml +++ b/templates/page/now.gohtml @@ -9,7 +9,9 @@
{{ range $now := .Person.Now }}
-

{{ .Name }}

+ {{ if ne .Name "" }} +

{{ .Name }}

+ {{ end }}

{{ .Description }}

{{ if and (ne .Link "") (ne .LinkName "") }}

{{ .LinkName }}

-- cgit v1.2.3 From 996ff551f05dee6db08c8eb4144e7db4a5dbeaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 16:37:10 +0200 Subject: fix(custom): header using old tag and not redirecting to new page --- templates/page/custom_page.gohtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/page/custom_page.gohtml b/templates/page/custom_page.gohtml index 5b4de00..7963a97 100644 --- a/templates/page/custom_page.gohtml +++ b/templates/page/custom_page.gohtml @@ -4,7 +4,7 @@

{{ .Title }}

{{ .GetContent }} -- cgit v1.2.3 From 26d21b4fa9c703a84b34ceabc13d0d5e19c90e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 16:48:17 +0200 Subject: feat(404): better handle --- main.go | 8 ++++++++ scss/main.scss | 1 + scss/tag.scss | 1 - templates/page/404.gohtml | 24 ++++++++++++++++++++++++ templates/page/legal.gohtml | 11 ++++++++--- 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 templates/page/404.gohtml diff --git a/main.go b/main.go index 6df8e79..3f8d3c2 100644 --- a/main.go +++ b/main.go @@ -140,6 +140,14 @@ func main() { } g.NotFoundHandler = func(w http.ResponseWriter, r *http.Request) { + g.Render(w, "404", &golatt.TemplateData{ + Title: "Not found :(", + SEO: &golatt.SeoData{ + URL: r.URL.Path, + Description: "Not found", + }, + Data: &cfg, + }) http.Redirect(w, r, "/", http.StatusTemporaryRedirect) } diff --git a/scss/main.scss b/scss/main.scss index adb87be..95213cf 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -118,6 +118,7 @@ h3 { h4 { font-size: 1.25rem; font-weight: bold; + margin-bottom: 0.5rem; } ul, ol { diff --git a/scss/tag.scss b/scss/tag.scss index a604380..516ecdb 100644 --- a/scss/tag.scss +++ b/scss/tag.scss @@ -17,7 +17,6 @@ } & p { display: block; - margin-top: 0.5rem; } } diff --git a/templates/page/404.gohtml b/templates/page/404.gohtml new file mode 100644 index 0000000..76f9128 --- /dev/null +++ b/templates/page/404.gohtml @@ -0,0 +1,24 @@ +{{define "body"}} +
+
+

404 - Not found

+ +
+

+ Oh no, you are lost. Do you need help? +

+ +
+{{end}} \ No newline at end of file diff --git a/templates/page/legal.gohtml b/templates/page/legal.gohtml index b3a3a54..0ed112a 100644 --- a/templates/page/legal.gohtml +++ b/templates/page/legal.gohtml @@ -1,11 +1,16 @@ {{define "body"}} - + {{end}} -- cgit v1.2.3 From 14f30577f9b5f76d288abce6ba19bf6150936401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 7 Sep 2025 16:54:10 +0200 Subject: perf(style): simplify css rules --- scss/main.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scss/main.scss b/scss/main.scss index 95213cf..2b3c2b7 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -72,7 +72,7 @@ main { margin-top: 10vh; margin-bottom: 10vh; max-width: 800px; - & h1, h2, h3 { + & h1 { margin: 0; } @media only screen and (max-width: vars.$bp-mid) { @@ -144,7 +144,6 @@ em { .header { display: flex; - align-items: center; justify-content: space-between; @media only screen and (max-width: vars.$bp-little) { flex-direction: column; -- cgit v1.2.3