Skip to content

Instantly share code, notes, and snippets.

@ErisDS
Last active February 13, 2020 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErisDS/497bb616a3bed01586ca7369fec94767 to your computer and use it in GitHub Desktop.
Save ErisDS/497bb616a3bed01586ca7369fec94767 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="https://unpkg.com/@tryghost/content-api@latest/umd/content-api.min.js"></script>
<script>
const api = new GhostContentAPI({
url: 'https://demo.ghost.io',
key: '22444f78447824223cefc48062',
version: "v3"
});
// Fetch a single post by slug
api.posts
.read({slug: 'style-test'})
.then((post) => {
console.log(post);
document.querySelector('#result').textContent = JSON.stringify(post);
})
.catch((err) => {
console.error(err);
});
</script>
</head>
<body>
<h1>Hello world</h1>
<div id="result"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment