aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.go1
-rw-r--r--index.ts4
-rw-r--r--schema.json6
-rw-r--r--templates/page/tags.gohtml2
4 files changed, 10 insertions, 3 deletions
diff --git a/data.go b/data.go
index 7c976e7..49df295 100644
--- a/data.go
+++ b/data.go
@@ -25,6 +25,7 @@ type Person struct {
type Tag struct {
Name string `json:"name"`
Description string `json:"description"`
+ Link string `json:"link"`
}
type Color struct {
diff --git a/index.ts b/index.ts
index 77a004a..e4b19d6 100644
--- a/index.ts
+++ b/index.ts
@@ -1,7 +1,9 @@
function setupEvents() {
document.querySelectorAll<HTMLElement>(".tag")?.forEach(t => {
t.addEventListener("click", _ => {
- // t.classList.toggle("active")
+ const link = t.getAttribute("data-href")
+ if (link === null || link === "") return
+ window.open(link)
})
})
diff --git a/schema.json b/schema.json
index d73f3db..2678ecf 100644
--- a/schema.json
+++ b/schema.json
@@ -155,12 +155,16 @@
},
"name": {
"type": "string"
+ },
+ "link": {
+ "type": "string"
}
},
"additionalProperties": false,
"required": [
"name",
- "description"
+ "description",
+ "link"
]
}
}
diff --git a/templates/page/tags.gohtml b/templates/page/tags.gohtml
index 4713ff4..8a81810 100644
--- a/templates/page/tags.gohtml
+++ b/templates/page/tags.gohtml
@@ -3,7 +3,7 @@
<h2>Tags</h2>
<div class="tags" style="{{ .Color.GetTagColor }}">
{{ range $tag := .Person.Tags }}
- <div class="tag">
+ <div class="tag" data-href="{{ .Link }}" title="{{ .Link }}">
<h4>{{ .Name }}</h4>
<p>{{ .Description }}</p>
</div>