Skip to content

The Edit bookmark

Use this bookmark to open a page in Content Studio.

Create the bookmark

This type of dynamic bookmark is called a bookmarklet.

By saving a bookmarklet, you can let it perform small tasks when you click it.

To create this bookmark:

  1. Create a bookmark to any page
  2. Right click the bookmark to edit it
  3. Give it a better name, like "Edit in XP"
  4. Replace the URL with the the code below (make sure to get all the lines of code copied!)
  5. Save and just click the bookmark on any open page running on our modern platform and a tab with the edit-mode of that page opens.
javascript: (function () {
  var metaID = document.querySelector("meta[name=pageID]").content;
  if (metaID) {
    var currentUrl = window.location.href;
    var siteUrlMap = {
      "gjensidige-builders.testgjensidige": "builders",
      "gjensidige-no.testgjensidige": "no",
      "gjensidige-se.testgjensidige": "se",
      "gjensidige-dk.testgjensidige": "dk",
      "gjensidige-com.testgjensidige": "com",
      "www.gjensidige.builders": "builders",
      "www.gjensidige.no": "no",
      "www.gjensidige.se": "se",
      "www.gjensidige.dk": "dk",
      "www.gjensidige.co": "com",
    };
    var isTestServer = currentUrl.includes(".testgjensidige");
    var addAppsInt = !currentUrl.includes("www.gjensidige.builders");

    for (var key in siteUrlMap) {
      if (currentUrl.includes(key)) {
        siteUrl = siteUrlMap[key];
        break;
      }
    }

    var editUrl =
      "https://gjensidige-" +
      siteUrl +
      "-admin" +
      (addAppsInt ? ".apps-int" : "") +
      "." +
      (isTestServer ? "test" : "") +
      "gjensidige.io/admin/tool/" +
      "com.enonic.app.contentstudio/main/default/edit/";
    window.open(editUrl + metaID);
  }
})();

 

How it works

This bookmarklet will analyze the current URL you are on. It will figure out if you are in production or test environment. It will also figure out if you are on .builders, .no, .se, .dk or .com.

Based on this information, it will redirect you to the correct edit-page within Content Studio - instantly!