Skip to content

Instantly share code, notes, and snippets.

@ErisDS
Last active May 10, 2024 15:34
Show Gist options
  • 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