Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Eleventy blog from API
<h1>API post list</h1>
{% for post in posts %}
<a href="/posts/{{ }}/">{{ post.title }}</a>
{% endfor %}
data: posts
size: 1
alias: post
permalink: posts/{{ }}/
<h1>{{ post.title }}</h1>
{{ post.body | safe }}
// Placed in _data/posts.js
const fetch = require("node-fetch");
module.exports = async function() {
const data = await fetch('');
const json = await data.json().then(data => data);
return json;
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.