title | tags | |
---|---|---|
about |
|
Created
August 27, 2019 00:52
-
-
Save KyleMit/1530a48f9ddc107ec25a9b87df8938c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "1ttyData", | |
"version": "1.0.0", | |
"description": "", | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"@11ty/eleventy": "^0.9.0-beta.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchIndex { | |
data() { | |
return { | |
// https://www.11ty.io/docs/languages/javascript/#permalinks | |
permalink: "/search2.json", | |
}; | |
} | |
render(data) { | |
let search = data.collections.post.map(item => { | |
return { | |
url: item.url, | |
title: item.data.title, | |
text: item.data.templateContent | |
} | |
}) | |
var stringify = JSON.stringify(search, null, 2) | |
return stringify; | |
} | |
} | |
module.exports = SearchIndex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
permalink: search.json | |
--- | |
[ | |
{%- for item in collections.post -%} | |
{ | |
"url" : "{{ item.url }}", | |
"title" : "{{ item.data.title }}", | |
"text" : "{{ item.templateContent }}" | |
}{% if not loop.last %},{% else %}{%- endif -%} | |
{%- endfor -%} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment