From 806d11f874119a1207332850e3263d87334a573d Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Wed, 27 Oct 2021 00:03:07 +0000
Subject: [PATCH] Merge pull request #23 from bur3ku/hugo
---
layouts/_default/single.html | 2 +-
layouts/partials/graph.html | 4 ++--
layouts/_default/_markup/render-link.html | 1 +
layouts/index.html | 2 +-
layouts/partials/backlinks.html | 9 ++++++---
5 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
index 0288029..f37614f 100644
--- a/layouts/_default/_markup/render-link.html
+++ b/layouts/_default/_markup/render-link.html
@@ -1,4 +1,5 @@
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
+{{$trimmed = replace $trimmed "%20" "-"}}
{{$external := strings.HasPrefix $trimmed "http" }}
{{ if $external }}
<a href="{{ $trimmed }}" rel="noopener">{{ .Text | safeHTML }}</a>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index c30cd4f..9f6443d 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -19,7 +19,7 @@
{{ .TableOfContents }}
</aside>
{{end}}
- {{- .Content -}}
+ {{.Content}}
</article>
{{partial "footer.html" .}}
</div>
diff --git a/layouts/index.html b/layouts/index.html
index c30cd4f..ce66744 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -24,5 +24,5 @@
{{partial "footer.html" .}}
</div>
</body>
-
</html>
+
diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html
index 2e97820..744f7e3 100644
--- a/layouts/partials/backlinks.html
+++ b/layouts/partials/backlinks.html
@@ -6,9 +6,12 @@
{{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
{{if $inbound}}
{{- range $inbound -}}
- <li>
- <a href="{{index . "source"}}">{{index . "source"}}</a>
- </li>
+ {{$src := index . "source"}}
+ {{$src = replace $src " " "-"}}
+
+ <li>
+ <a href="{{$src}}">{{index . "source"}}</a>
+ </li>
{{- end -}}
{{else}}
<li>
diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html
index 0e9684d..d529e8d 100644
--- a/layouts/partials/graph.html
+++ b/layouts/partials/graph.html
@@ -126,7 +126,7 @@
.attr("fill", color)
.style("cursor", "pointer")
.on("click", (_, d) => {
- window.location.href = {{.Site.BaseURL}} + d.id;
+ window.location.href = {{.Site.BaseURL}} + d.id.replace(" ", "-").replace("%20", "-");
})
.on("mouseover", function (_, d) {
d3.selectAll(".node")
@@ -184,7 +184,7 @@
const labels = graphNode.append("text")
.attr("dx", 12)
.attr("dy", ".35em")
- .text((d) => d.id)
+ .text((d) => encodeURI(d.id))
.style("opacity", 0)
.style("pointer-events", "none")
.call(drag(simulation));
--
Gitblit v1.10.0