aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2025-09-07 15:32:45 +0200
committerWilliam Hergès <william@herges.fr>2025-09-07 15:32:45 +0200
commit36963a2839b33121de235c5e16743e508a52b9ea (patch)
tree0b100d30246bf1a817a830ce2b2c5d237a330f3d
parente2f739c9e19f57b72b599eaf5bfc10265e62ddb8 (diff)
feat(now): modify how links are handled
-rw-r--r--data.go1
-rw-r--r--index.ts9
-rw-r--r--main.go4
-rw-r--r--scss/tag.scss1
-rw-r--r--templates/page/now.gohtml6
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<HTMLElement>(".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<HTMLAnchorElement>("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 @@
</div>
<div class="tags" style="{{ .Color.GetTagColor }}">
{{ range $tag := .Person.Tags }}
- <div class="tag" data-href="{{ .Link }}" title="{{ .Link }}">
+ <div class="tag">
<h4>{{ .Name }}</h4>
<p>{{ .Description }}</p>
- <p><a href="">Hello</a></p>
+ {{ if and (ne .Link "") (ne .LinkName "") }}
+ <p><a href="{{ .Link }}">{{ .LinkName }}</a></p>
+ {{ end }}
</div>
{{ end }}
</div>