Skip to content

Instantly share code, notes, and snippets.

@KyleMit

KyleMit/about.md

Created Aug 27, 2019
Embed
What would you like to do?
title tags
about
post

My About Page

title tags
index
post

My Home Page

{
"name": "1ttyData",
"version": "1.0.0",
"description": "",
"author": "",
"license": "ISC",
"devDependencies": {
"@11ty/eleventy": "^0.9.0-beta.3"
}
}
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;
---
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
You can’t perform that action at this time.