Ability to duplicate sites


#1

Hi, is it possible to duplicate a site within the cms and change it to another site? In that case you don’t have to sett-up the whole site again. (specially if you work with a lot of templates and code snippets)


Sub Administrators
#2

This isn’t possible through the UI, but if you’re setting up multiple sites that share the same snippets or templates you can do this through the API.

What’s your use case for sharing the same templates for different sites?


#3

I’m creating a site for a school, which has a 5 departments. Every department has it’s own cms user(s) and I’m setting up separated sites (subdirs in the hosting root) within the cms. To keep it as clean and simple as possible for the users. But all the subsites use the same snippets and templates. If I do it the old way, it’s time consuming copy pasting code :slight_smile:


#4

I see. That makes sense, but duplicating the site wouldn’t ensure the templates and snippets remained in sync when changes are made. This would be more like a “global assets” feature or something to that effect.


#5

“Global assets” feature, I like that :slight_smile:
But indeed, working with the surreal templates is creating pages from some predefined styled pages. It’s not a real template that updates all used pages. For templating I’m using the php includes, works like a charm. But like you mentioned before, I’ll check out the the API. Can you give me a quick start for applying the snippets to other (sub)sites. Thanks and regs from Belgium


#6

You’d need to know the site IDs of all the sites you want to create snippets for. Generally you’d have an app that keeps track of them, but you can fetch the IDs from the API as well.

To create a snippet, you’ll want to send a POST request to the following endpoint:

POST https://edit-content.com/api/v1/sites/<site-id>/snippets

Just pass name and code strings as post data and you’ll receive a response such as this:

{
    "status": "success",
    "snippet": {
        "id": 1234
    }
}