1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-17 10:55:31 -04:00

Generate index of content for Algolia search (#50)

This commit is contained in:
2020-03-03 15:41:15 -05:00
committed by GitHub
parent 4b1b2401f8
commit a48c16d65c
4 changed files with 1846 additions and 32 deletions

View File

@@ -28,6 +28,10 @@ disableAliases = true
copyrightFirstYear = "2001"
wayback = "https://web.archive.org/web/20010501000000*/jakejarvis.com"
[params.algolia]
vars = ["title", "summary", "date", "permalink", "draft"]
params = ["tags"]
[author]
name = "Jake Jarvis"
jobTitle = "Front-End Web Developer"
@@ -42,7 +46,7 @@ disableAliases = true
mastodon = "mastodon.social/@jakejarvis"
[outputs]
home = ["HTML", "RSS", "MANIFEST", "REDIRECTS", "HEADERS"]
home = ["HTML", "RSS", "ALGOLIA", "MANIFEST", "REDIRECTS", "HEADERS"]
section = ["HTML"]
page = ["HTML", "AMP"]
@@ -60,6 +64,11 @@ disableAliases = true
path = "."
permalinkable = true
isHTML = true
[outputFormats.ALGOLIA]
mediaType = "application/json"
baseName = "algolia"
isPlainText = true
notAlternative = true
[outputFormats.MANIFEST]
mediaType = "application/json"
baseName = "manifest"

View File

@@ -0,0 +1,8 @@
{{- $.Scratch.Add "index" slice -}}
{{- $section := $.Site.GetPage "section" .Section }}
{{- range .Site.AllPages -}}
{{- if or (and (.IsDescendant $section) (and (not .Draft) (not .Params.private))) $section.IsHome -}}
{{- $.Scratch.Add "index" (dict "objectID" .File.UniqueID "date" .Date.UTC.Unix "description" .Description "kind" .Kind "lang" .Lang "lastmod" .Lastmod.UTC.Unix "permalink" .Permalink "publishdate" .PublishDate "readingtime" .ReadingTime "summary" .Summary "title" .Title "type" .Type "url" .RelPermalink "weight" .Weight "wordcount" .WordCount "section" .Section "tags" .Params.Tags "authors" $.Site.Author.name)}}
{{- end -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

View File

@@ -28,11 +28,14 @@
"lint:markdown": "markdownlint --rules markdownlint-rule-emphasis-style content/**/*.md",
"lint:spellcheck": "mdspell --en-us --ignore-numbers --ignore-acronyms --report content/**/*.md content/notes/**/*.md content/_index.html",
"lint:links": "linkinator http://localhost:1337/ --recurse --silent --skip https://www.shodan.io/ --skip https://images.shodan.io/ --skip https://archive.today/ --skip https://archive.is/ --skip https://www.linkedin.com/ --skip http://localhost:1337/y2k/ --skip 'asdfasdf404/?$' || true",
"index": "run-s clean hugo index:** clean",
"index:algolia": "atomic-algolia",
"debug:hugo": "hugo version && hugo env",
"debug:size": "get-folder-size --folder=public"
},
"dependencies": {},
"devDependencies": {
"atomic-algolia": "^0.3.17",
"autoprefixer": "^9.7.4",
"cross-env": "^7.0.1",
"get-folder-size": "^2.0.1",

1856
yarn.lock

File diff suppressed because it is too large Load Diff