diff options
author | otis <xiaohei.zyx@gmail.com> | 2019-11-14 05:40:35 +0300 |
---|---|---|
committer | otis <xiaohei.zyx@gmail.com> | 2019-11-14 05:40:35 +0300 |
commit | b03c8f46d14025c3ada1138588373e3caec97616 (patch) | |
tree | f76c17c763b6c5654f9965cb45fce8af33a1cb88 | |
parent | cbf83f6c13b88141f71c16b7e3a776d3c0bd59fe (diff) |
fix search unavailable & some context error
-rw-r--r-- | layouts/_default/list.searchindex.json | 2 | ||||
-rw-r--r-- | layouts/partials/_widgets/recent_posts.html | 4 | ||||
-rw-r--r-- | layouts/partials/script.html | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/layouts/_default/list.searchindex.json b/layouts/_default/list.searchindex.json index 28ddbf6..4e93e79 100644 --- a/layouts/_default/list.searchindex.json +++ b/layouts/_default/list.searchindex.json @@ -7,7 +7,7 @@ {{- $.Scratch.Add "tags" (dict "title" .Page.Title "uri" .Page.Permalink) -}} {{- end -}} {{- $.Scratch.Add "posts" slice -}} -{{- range $index, $element := (where .Site.Pages "Type" "posts") -}} +{{- range $index, $element := (where .Site.RegularPages "Type" "posts") -}} {{- $.Scratch.Add "posts" (dict "id" $index "title" $element.Title "uri" $element.Permalink "tags" $element.Params.tags "section" $element.Section "content" $element.Plain "summary" $element.Summary "year" ($element.Date.Format "2006")) -}} {{- end -}} {{- $.Scratch.SetInMap "searchindex" "posts" ($.Scratch.Get "posts") }} diff --git a/layouts/partials/_widgets/recent_posts.html b/layouts/partials/_widgets/recent_posts.html index 631767a..4546d8c 100644 --- a/layouts/partials/_widgets/recent_posts.html +++ b/layouts/partials/_widgets/recent_posts.html @@ -1,9 +1,9 @@ -{{- if $.Pages }} +{{- if $.Site.RegularPages }} <div class="widget"> <h3 class="widget-title">{{T "widget_recent_posts" }}</h3> <div class="widget-body"> <ul class="recent-post-list list-unstyled no-thumbnail"> - {{- range first 5 (where $.Pages "Section" "posts") }} + {{- range first 5 (where $.Site.RegularPages "Type" "posts") }} <li> <div class="item-inner"> <p class="item-title"> diff --git a/layouts/partials/script.html b/layouts/partials/script.html index 685120b..06dd69a 100644 --- a/layouts/partials/script.html +++ b/layouts/partials/script.html @@ -27,7 +27,7 @@ hljs.initHighlightingOnLoad(); UNTITLED: '{{ T "insight_untitled"}}', }, ROOT_URL: '{{ .Site.BaseURL }}', - CONTENT_URL: '{{ "/searchindex.json" | absURL }} ', + CONTENT_URL: '{{ print .Site.BaseURL "/searchindex.json" | safeURL }} ', }; window.INSIGHT_CONFIG = INSIGHT_CONFIG; })(window); |