Skip to content

Commit

Permalink
feat(search): improve search index
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Apr 28, 2020
1 parent ea655d9 commit 26381b4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1 class="single-title" itemprop="name headline">
{{ T "publish" }}&nbsp;<time datetime={{ $publish_date }}>{{ $publish_date }}</time>
</span>

{{- with $params.categories -}}
{{- with .Params.categories -}}
&nbsp;
<span class="post-category">
{{- T "included" -}}
Expand All @@ -56,7 +56,7 @@ <h1 class="single-title" itemprop="name headline">
{{- /* Footer */ -}}
<div class="post-footer">
<a href="{{ .RelPermalink }}">{{ T "readMore" }}</a>
{{- with $params.tags -}}
{{- with .Params.tags -}}
<div class="post-tags">
<i class="fas fa-tags fa-fw"></i>&nbsp;
{{- range $index, $value := . -}}
Expand Down
7 changes: 3 additions & 4 deletions layouts/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- end -}}
{{- range $pages -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{- $one := dict "uri" .RelPermalink "title" .Title "description" (.Description | default "") -}}
{{- $tags := $params.tags | default slice -}}
{{- $one := dict "objectID" .RelPermalink "uri" .RelPermalink "title" .Title "description" (.Description | default "") -}}
{{- $tags := .Params.tags | default slice -}}
{{- $one = delimit $tags "\n" | dict "tags" | merge $one -}}
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormat | default "2006-01-02") -}}
{{- $one = dict "date" $publish_date | merge $one -}}
{{- $content := dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | plainify -}}
{{- $content := .RawContent -}}
{{- if gt .Site.Params.search.contentLength 0 -}}
{{- $content = substr $content 0 .Site.Params.search.contentLength -}}
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/single/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

<div class="post-info-more">
<section class="post-tags">
{{- with $params.tags -}}
{{- with .Params.tags -}}
<i class="fas fa-tags fa-fw"></i>&nbsp;
{{- range $index, $value := . -}}
{{- if gt $index 0 }},&nbsp;{{ end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 class="single-subtitle">{{ . }}</h2>
{{- partial "plugin/link.html" $options -}}
</span>

{{- with $params.categories -}}
{{- with .Params.categories -}}
&nbsp;
<span class="post-category">
{{- T "included" -}}
Expand Down

0 comments on commit 26381b4

Please sign in to comment.