Demandbase Connect

Echo Community Wiki / How To - Permalinking
View
 

How To - Permalinking

Page history last edited by Andrew 11 months ago

 

 

How To - Permalinking

 

Echo Permalinking learns from the best examples of Twitter and Facebook whereby each item gets its own dedicated page.

 

To achieve the permalinking effect 2 components are required:

 

  • A plugin for the Echo.Stream application to add the permanent URL hyperlink into the stream item UI. For example the static timestamp field can be converted into the item permanent URl hyperlink. You can use the "ItemPermalink" plugin developed by our Community, which can be configured as required. Let's imagine that you want to render the item on the "permalink.html" page on your site. In this case the "ItemPermalink" plugin should be configured as shown below:

new Echo.Stream({

    "target": document.getElementById("echo-stream"),

    "appkey": "test.echoenabled.com",

    "query": "childrenof:http://www.example.com/article.html itemsPerPage:10", 

    "plugins": [{

        "name": "ItemPermalink",

        // [ID] in the field below will be replaced with the object.id value of the item

        "format": "http://www.your-domain.com/permalink.html?id=[ID]"

    }]

});

 

  • A page on your web-server hosted at the URL specified in the previous step with another Echo.Stream application installed ("permalink.html" in our example). Echo.Stream application should perform search query with the "url" predicate and id of the item as a value to display the item content and its children (if required). The code to initialize the Echo.Stream application to render the item may look like:

var id = window.location.search.match(/id=(.*)/)[1];

new Echo.Stream({

    "target": document.getElementById("echo-stream"),

    "appkey": "test.echoenabled.com",

    "query": "url:" + id + " children state:Untouched,ModeratorApproved"

});

 

Please note: the implementation may be different for each specific use-case and this instruction describes the basic idea of permalinking with a working example.