diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index f0d52ce..43af436 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -68,8 +68,15 @@ outputFormats: # 自定义生成本地搜索文件 # Custom file of indexes for local search SearchIndexes: - mediaType: "application/xml" - baseName: "searchindexes" + mediaType: application/xml + baseName: searchindexes + isPlainText: true + notAlternative: true + # 生成 Algolia 索引文件 + # Build indexes of Aloglia + AlgoliaIndexes: + mediaType: application/json + baseName: algolia isPlainText: true notAlternative: true diff --git a/layouts/_default/list.algoliaindexes.json b/layouts/_default/list.algoliaindexes.json new file mode 100644 index 0000000..909fa6a --- /dev/null +++ b/layouts/_default/list.algoliaindexes.json @@ -0,0 +1,12 @@ +[ + {{- range $index, $entry := where .Site.RegularPages "Kind" "page" }} + {{- if $index }}, {{ end }} + { + "permalink": "{{ .Permalink | relURL }}", + "title": {{ .Title | jsonify }}, + "content": {{ replace .Plain | jsonify }}, + "date": {{ .Date.Format $.Site.Params.timeFormat | jsonify }}, + "updated": {{ .Lastmod.Format $.Site.Params.timeFormat | jsonify }} + } + {{- end }} +] \ No newline at end of file diff --git a/layouts/_default/list.searchindexes.xml b/layouts/_default/list.localindexes.xml similarity index 100% rename from layouts/_default/list.searchindexes.xml rename to layouts/_default/list.localindexes.xml