getHtml
getHtml
The getHtml
method is used to get the HTML content of a given element.
import { zefer } from "zefer-lib";
const getPost = zefer.getPost(process.env.ZEFER_API_KEY as string, 'POST_ID or SLUG/TITLE_ID').then((response) => { // get specific post const html = zefer.getHtml(response?.content); // get HTML of the blog post content console.log(html); });
// or
(async () => { const response = await zefer.getPost(process.env.ZEFER_API_KEY as string, 'POST_ID or SLUG/TITLE_ID'); // get specific post const html = zefer.getHtml(response?.content); // get HTML of the blog post content console.log(html);})();
Parameters
Name | Type | Description |
---|---|---|
content | JSONContent | The content body of the blog post e.g. response?.content |