From c1b0eafce668c0c7498a5875c23c074eeb71e842 Mon Sep 17 00:00:00 2001
From: chaosarium <38693485+chaosarium@users.noreply.github.com>
Date: Thu, 22 Dec 2022 18:34:21 +0000
Subject: [PATCH] feat: Added simplified Chinese translations (#257)

---
 layouts/partials/textprocessing.html |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index 7b82f32..dbcc053 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -42,7 +42,24 @@
     <!-- remove subfolder from title -->
     {{$display := index (last 1 (split $display "/")) 0}}
 
-    {{$curpage := $page.GetPage $title}}
+    <!-- attempt to get title -->
+    {{$searchtitle := $title }}
+    {{$curpage := $page.GetPage $searchtitle }}
+    <!-- attempt to search md file instead  -->
+    {{ if (eq $curpage.String "nopPage") }}
+      {{$searchtitle = (add $title ".md") }}
+      {{$curpage = $page.GetPage $searchtitle }}
+    {{ end }}
+    <!-- attempt to reverse typographer behaviour  -->
+    {{ if (eq $curpage.String "nopPage") }}
+      {{$searchtitle = (replace $searchtitle "&amp;" "&") }}
+      {{$searchtitle = (replace $searchtitle "&quot;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&rdquo;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&ldquo;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&rsquo;" "'") }}
+      {{$searchtitle = (replace $searchtitle "&lsquo;" "'") }}
+      {{$curpage = $page.GetPage $searchtitle }}
+    {{ end }}
     {{$relpath := relURL $path}}
 
     <!-- If path to Hugo page -->

--
Gitblit v1.10.0