From 56d2382c282431115b2964d440b790ce11f19e72 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 23 Dec 2021 22:05:27 +0000
Subject: [PATCH] fix relative link styling, change graph and backlinks to refer to name rather than path
---
layouts/partials/graph.html | 13 +++++++------
assets/base.scss | 10 ++++------
content/_index.md | 2 +-
layouts/partials/backlinks.html | 5 +++--
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/assets/base.scss b/assets/base.scss
index bd0b609..f50e9cc 100644
--- a/assets/base.scss
+++ b/assets/base.scss
@@ -128,9 +128,6 @@
article a {
font-family: Source Sans Pro;
font-weight: 600;
- text-decoration: underline;
- text-decoration-color: var(--tertiary);
- text-decoration-thickness: .15em;
}
sup > a {
@@ -191,10 +188,11 @@
}
// internal link
-a[href^="/"] {
+a[href^="./"] {
text-decoration: none;
- background-color: #afbfc922;
+ background-color: #afbfc933;
padding: 0 0.2em;
+ font-weight: 600;
border-radius: 3px;
}
@@ -370,4 +368,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/content/_index.md b/content/_index.md
index d981591..5f2e267 100644
--- a/content/_index.md
+++ b/content/_index.md
@@ -15,4 +15,4 @@
## Troubleshooting
- 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md)
-- 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
\ No newline at end of file
+- 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html
index 744f7e3..9020bf7 100644
--- a/layouts/partials/backlinks.html
+++ b/layouts/partials/backlinks.html
@@ -4,13 +4,14 @@
{{$host := strings.TrimRight "/" $url.Path }}
{{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink) }}
{{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
+ {{$contentTable := $.Site.Data.contentIndex}}
{{if $inbound}}
{{- range $inbound -}}
{{$src := index . "source"}}
{{$src = replace $src " " "-"}}
<li>
- <a href="{{$src}}">{{index . "source"}}</a>
+ <a href="{{$src}}">{{index (index $contentTable $src) "title"}}</a>
</li>
{{- end -}}
{{else}}
@@ -18,4 +19,4 @@
No backlinks found
</li>
{{end}}
-</ul>
\ No newline at end of file
+</ul>
diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html
index dbd33d1..a963743 100644
--- a/layouts/partials/graph.html
+++ b/layouts/partials/graph.html
@@ -13,6 +13,7 @@
<script>
const index = {{$.Site.Data.linkIndex.index}}
const links = {{$.Site.Data.linkIndex.links}}
+ const content = {{$.Site.Data.contentIndex}}
const curPage = {{ strings.TrimRight "/" .Page.RelPermalink }}
const pathColors = {{$.Site.Data.graphConfig.paths}}
@@ -137,7 +138,7 @@
const neighbours = parseIdsFromLinks([...(index.links[d.id] || []), ...(index.backlinks[d.id] || [])])
const neighbourNodes = d3.selectAll(".node").filter(d => neighbours.includes(d.id))
const currentId = d.id
- const links = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
+ const linkNodes = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
// highlight neighbour nodes
neighbourNodes
@@ -146,7 +147,7 @@
.attr("fill", color)
// highlight links
- links
+ linkNodes
.transition()
.duration(200)
.attr("stroke", "var(--g-link-active)")
@@ -165,9 +166,9 @@
.attr("fill", color)
const currentId = d.id
- const links = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
+ const linkNodes = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
- links
+ linkNodes
.transition()
.duration(200)
.attr("stroke", "var(--g-link)")
@@ -184,7 +185,7 @@
const labels = graphNode.append("text")
.attr("dx", 12)
.attr("dy", ".35em")
- .text((d) => d.id.replace("%20", "-"))
+ .text((d) => content[d.id.replace("%20", "-")].title)
.style("opacity", 0)
.style("pointer-events", "none")
.call(drag(simulation));
@@ -216,4 +217,4 @@
.attr("x", d => d.x)
.attr("y", d => d.y);
});
-</script>
\ No newline at end of file
+</script>
--
Gitblit v1.10.0