mirror of
https://github.com/kremalicious/blog.git
synced 2025-01-03 18:35:07 +01:00
kremalicious as a service
- output all posts with all metadata as json
This commit is contained in:
parent
7e27e9c67c
commit
d504173527
@ -73,7 +73,7 @@ var Search = (function(w, d) {
|
||||
SimpleJekyllSearch({
|
||||
searchInput: document.getElementById('search-input'),
|
||||
resultsContainer: document.getElementById('search-results'),
|
||||
json: '/search.json',
|
||||
json: '/api/search.json',
|
||||
searchResultTemplate: '<a class="search-link" href="{url}">{title}</a>',
|
||||
fuzzy: false
|
||||
});
|
||||
|
22
_src/api/posts.json
Normal file
22
_src/api/posts.json
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
layout: null
|
||||
---
|
||||
[
|
||||
{% for post in site.posts %}
|
||||
{
|
||||
"title" : {{ post.title | titlecase | jsonify }},
|
||||
"excerpt" : {{ post.excerpt | jsonify }},
|
||||
"category" : "{{ post.categories | join: ', ' }}",
|
||||
"tag" : "{{ post.tags | join: ', ' }}",
|
||||
"url" : "{{ site.url }}{{ post.url }}",
|
||||
"date" : "{{ post.date }}",
|
||||
"content" : {{ post.content | jsonify }},
|
||||
"image" : "{{ post.image }}",
|
||||
"author" : "{{ post.author }}",
|
||||
"layout" : "{{ post.layout }}",
|
||||
"id" : "{{ post.id }}",
|
||||
"path" : "{{ post.path }}",
|
||||
"download" : "{{ post.download }}"
|
||||
} {% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
]
|
@ -5,11 +5,13 @@ layout: null
|
||||
{% for post in site.posts %}
|
||||
{
|
||||
"title" : "{{ post.title | strip_html | strip_newlines | titlecase }}",
|
||||
"excerpt" : "{{ post.excerpt | strip_html | strip_newlines }}",
|
||||
"category" : "{{ post.categories | join: ', ' }}",
|
||||
"tag" : "{{ post.tags | join: ', ' }}",
|
||||
"url" : "{{ site.url }}{{ post.url }}",
|
||||
"date" : "{{ post.date }}",
|
||||
"content" : "{{ post.content | strip_html | strip_newlines | escape }}"
|
||||
"image" : "{{ post.image }}",
|
||||
"content" : "{{ post.content | strip_html | strip_newlines | xml_escape }}"
|
||||
} {% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
]
|
10
_src/api/site.json
Normal file
10
_src/api/site.json
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
layout: null
|
||||
---
|
||||
[
|
||||
{
|
||||
"name" : "{{ site.name }}",
|
||||
"description" : "{{ site.description | xml_escape }}",
|
||||
"url" : "{{ site.url }}"
|
||||
}
|
||||
]
|
@ -6,5 +6,6 @@ Disallow: /search/
|
||||
Disallow: /page/
|
||||
Disallow: /*/page/
|
||||
Disallow: /tag/
|
||||
Disallow: /api/
|
||||
|
||||
Sitemap: {{ site.url }}/sitemap.xml
|
||||
|
Loading…
Reference in New Issue
Block a user