Add content to your site

IMPORTANT! friendlyCMS uses JQuery under the hood so you will need to also import that from the CDN:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

Step one

Add this code snippet to your html file:

<script src="https://cms.friendlysoftware.co.uk/integration/friendlycms.js"></script>

Step two - add content placeholder

Add this element where you want your content to drop in:

<div class="content-placeholder"></div>

Step three - get content

Then use the getContent method in the javascript file you imported, like so:

<script>
    getContent("name_of_content", "name_of_your_friendly_account", "content");
</script>

NB: If your putting more than one placeholder in a page, give them different ids and pass those ids to the method:

<div class="custom_id"></div> <script>
    getContent("name_of_content", "name_of_your_friendly_account", "content", "custom_id");
</script>

Dynamic alternative

Alternatively, if you want to get content dynamically, create a page which accepts the querystring parameter of the name of your page (called 'page') and do add the following below the content element

<!-- URL https://yoururl.com/template_page.html?page=nameofpage -->
<script>
    getContent(getUrlParameter('page'), "name_of_your_friendly_account", "content");
</script>

Add blogs to your site

Step one

As with content, add this code snippet to your html file:

<script src="https://cms.friendlysoftware.co.uk/integration/friendlycms.js"></script>

Step two - get blogs

Then, on your site create a "blog.html" in your root, use the renderItemList() method in the javascript file you imported, like so:

<div id="id_of_your_div"</div> <script>
    renderItemList("name_of_your_friendly_account", "blog", "id_of_your_div");
</script>

This will render all of your blog posts as an unordered list in the page.

Step three - create post.html

Here we will integrate the blog posts similarly to the pages in the content section.

<!-- URL https://yoururl.com/post.html?blog=nameofblog -->
<script>
    getContent(getUrlParameter('blog'), "name_of_your_friendly_account", "blog");
</script>