summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroninro <liumy.f@foxmail.com>2022-10-18 11:55:08 +0800
committerroninro <liumy.f@foxmail.com>2022-10-18 11:55:08 +0800
commit46225bf4336fe6e46a7566248330e2d3ce21061f (patch)
tree296729fd4d4a0bd383ecc3d496309796c0cf643c
parent37aa60481eeeddcfa57561c376b6edb28215d005 (diff)
fix #3
-rw-r--r--assets/js/search.js2
-rw-r--r--exampleSite/config.toml8
-rw-r--r--exampleSite/content/posts/rich-content.md2
-rw-r--r--exampleSite/content/series/themes-guide/_index.md2
-rw-r--r--layouts/_default/_markup/render-link.html1
-rw-r--r--layouts/_default/baseof.html22
-rw-r--r--layouts/partials/footer.html8
-rw-r--r--layouts/partials/header.html0
-rw-r--r--layouts/partials/short-about.html4
-rw-r--r--layouts/partials/sidebar.html0
-rw-r--r--layouts/partials/sns-links.html2
11 files changed, 29 insertions, 22 deletions
diff --git a/assets/js/search.js b/assets/js/search.js
index 8ab0e16..34089d0 100644
--- a/assets/js/search.js
+++ b/assets/js/search.js
@@ -9,7 +9,7 @@ function htmlDecode(input) {
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('search-results'),
- json: '/index.json',
+ json: '{{ "index.json" | relURL }}',
searchResultTemplate: '<div class="post-preview item"><a href="{url}"><h2 class="post-title">{title}</h2><h3 class="post-subtitle">{subtitle}</h3><hr></a></div>',
noResultsText: 'No results',
limit: 50,
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 57a0510..91746c1 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -1,4 +1,4 @@
-baseURL = "http://localhost:1313/"
+baseURL = "http://localhost:1313/subdir"
title = "Puppet"
theme = "puppet"
@@ -72,8 +72,8 @@ weight = 100
author = "Puppet"
description = "A simple and clean theme for Hugo"
keywords = "blog,developer,personal"
-img_home = "/img/home-bg.jpg"
-img_404 = "/img/404-bg.jpg"
+img_home = "img/home-bg.jpg"
+img_404 = "img/404-bg.jpg"
useFaviconGenerator = true
@@ -82,7 +82,7 @@ custom_css = [] # ["css/custom.css"] Add your file to assets folder [assets/cs
[params.sidebar]
enable = true
-avatar = "/img/home-bg.jpg"
+avatar = "img/home-bg.jpg"
bio = "a personal website"
[params.social]
diff --git a/exampleSite/content/posts/rich-content.md b/exampleSite/content/posts/rich-content.md
index 1bfc90f..08d5725 100644
--- a/exampleSite/content/posts/rich-content.md
+++ b/exampleSite/content/posts/rich-content.md
@@ -9,7 +9,7 @@ tags = [
"MarkDown"
]
subtitle = "A brief description of Hugo Shortcodes"
-header_img = "/img/404-bg.jpg"
+header_img = "img/404-bg.jpg"
+++
Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugos-built-in-shortcodes) for rich content, along with a [Privacy Config](https://gohugo.io/about/hugo-and-gdpr/) and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds.
diff --git a/exampleSite/content/series/themes-guide/_index.md b/exampleSite/content/series/themes-guide/_index.md
index 3e1ece6..60c4f77 100644
--- a/exampleSite/content/series/themes-guide/_index.md
+++ b/exampleSite/content/series/themes-guide/_index.md
@@ -1,6 +1,6 @@
+++
title = "Themes Guide"
description = "a series of posts about configuring and using Hugo themes"
-header_img = "/img/home-bg.jpg"
+header_img = "img/home-bg.jpg"
short = true
+++ \ No newline at end of file
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
new file mode 100644
index 0000000..ecfef67
--- /dev/null
+++ b/layouts/_default/_markup/render-link.html
@@ -0,0 +1 @@
+<a href="{{ .Destination | relURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a> \ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index e576d62..49a4c23 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -22,7 +22,7 @@
{{ template "_internal/twitter_cards.html" . }}
{{ template "_internal/opengraph.html" . }}
- <link rel="stylesheet" href="/css/bootstrap.min.css" crossorigin="anonymous">
+ <link rel="stylesheet" href="{{ "css/bootstrap.min.css" | relURL }}" crossorigin="anonymous">
<!-- Hux change font-awesome CDN to qiniu -->
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"
type="text/css">
@@ -43,7 +43,7 @@
{{ end }}
{{ end }}
- <script src="/js/lazysizes.min.js"></script>
+ <script src={{ "js/lazysizes.min.js" | relURL }}></script>
<!-- custom js -->
{{ range .Site.Params.custom_js -}}
@@ -59,11 +59,17 @@
{{ end -}}
{{ if .Site.Params.useFaviconGenerator }}
- <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
- <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
- <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
- <link rel="manifest" href="/site.webmanifest">
- {{ end }}
+ <link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}">
+ <link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}">
+ <link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}">
+ <link rel="manifest" href="{{ "site.webmanifest" | relURL }}">
+ {{ else }}
+ <link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | relURL }}">
+ <link rel="shortcut icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon">
+ <link rel="shortcut icon" href="{{ "favicon.ico" | relURL }}" type="image/x-icon">
+ <link rel="icon" href="{{ "logo.svg" | relURL }}" sizes="any" type="image/svg+xml" />
+{{ end }}
+
</head>
<!-- hack iOS CSS :active style -->
@@ -77,7 +83,7 @@
{{ $header_img = .Site.Params.img_404 }}
{{ end }}
{{ if $header_img }}
- {{ .Scratch.Set "header_img" $header_img }}
+ {{ .Scratch.Set "header_img" ( $header_img | relURL ) }}
{{ end }}
{{ if and .IsPage (.Params.toc) }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 4659bb8..b4524e0 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -19,17 +19,17 @@
</div>
</footer>
-<script src="/js/jquery.min.js"></script>
-<script src="/js/bootstrap.min.js" crossorigin="anonymous"></script>
+<script src={{ "js/jquery.min.js" | relURL }}></script>
+<script src={{"js/bootstrap.min.js" | relURL }} crossorigin="anonymous"></script>
<!-- Custom Theme JavaScript -->
{{ $mainJs := resources.Get "js/hux-blog.js" | minify | fingerprint }}
<script src="{{ $mainJs.RelPermalink }}"></script>
<!-- Simple Jekyll Search -->
-<script src="/js/simple-jekyll-search.min.js"></script>
+<script src={{ "js/simple-jekyll-search.min.js" | relURL }}></script>
-{{ $searchJs := resources.Get "js/search.js" | minify | fingerprint }}
+{{ $searchJs := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" . | minify | fingerprint }}
<script src="{{ $searchJs.RelPermalink }}"></script>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
deleted file mode 100644
index e69de29..0000000
--- a/layouts/partials/header.html
+++ /dev/null
diff --git a/layouts/partials/short-about.html b/layouts/partials/short-about.html
index a560382..4a1487d 100644
--- a/layouts/partials/short-about.html
+++ b/layouts/partials/short-about.html
@@ -2,7 +2,7 @@
<section class="visible-md visible-lg">
<hr>
{{ with .Site.GetPage "/about" }}
- <h5><a href="/about/">ABOUT ME</a></h5>
+ <h5><a href={{"about/" | relURL }}>ABOUT ME</a></h5>
{{ else }}
<h5>ABOUT ME</h5>
{{ end }}
@@ -10,7 +10,7 @@
{{ $sidebar := .Site.Params.sidebar }}
<div class="short-about">
{{ with $sidebar.avatar }}
- <img src="{{ $sidebar.avatar }}" />
+ <img src="{{ $sidebar.avatar | relURL }}" />
{{ end }}
{{ with $sidebar.bio }}
<p>{{ $sidebar.bio }}</p>
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
deleted file mode 100644
index e69de29..0000000
--- a/layouts/partials/sidebar.html
+++ /dev/null
diff --git a/layouts/partials/sns-links.html b/layouts/partials/sns-links.html
index 73746cd..86e986e 100644
--- a/layouts/partials/sns-links.html
+++ b/layouts/partials/sns-links.html
@@ -7,7 +7,7 @@
{{ end}}
{{ with $social.rss_enable }}
<li>
- <a href="/index.xml">
+ <a href={{"index.xml" | relURL }}>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-rss fa-stack-1x fa-inverse"></i>