Last active
May 10, 2024 15:34
-
-
Save ErisDS/497bb616a3bed01586ca7369fec94767 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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