Direct linking to specific posts

If you are using the Live Center JavaScript library on the client to render your feeds and you want full control of the position of the linked post, you can request the content of a post and render it in a way you see fit.

Use a BulletinPullProvider to request a posts content like this:

//Returns a promise for you to act upon 
bulletinProvider.getBulletin(bulletinId, channelId)

If you are using the function NcPosts.start to maintain a live feed, you can find a BulletinPullProvider on the "bulletinProvider" property of the control object returned from NcPosts.start.

In your link you need to include both the bulletinId and channelId that you pass to the getBulletin call.

To render the post with the same renderes used in the feed, you can use the postFactory property on the listManager used by the feed. If you are using NcPosts.start, you can find the listManager used on the control object.

Full front-end example:

//Start the feed
var feedControl = NcPosts.start({...});

//Read the URL
var linkedBulletinId = ...

//Request the specified post
feedControl.bulletinProvider.getBulletin(bulletinId, feedControl.channelId).then(function(d){

   //Create a post to control the rendering of a post.
   var linkedPost = feedControl.listManager.postFactory(linkedBulletinId);

   //Update the post with the content received
   linkedPost.update(d);

   //Insert the linked post where you see fit
   document.getElementById("linked-post").appendChild(linkedPost.postContainer);
});

Custom title and description

To achieve a title and description related to the linked post on a link on your own domain, you need to render the <title> tag and <meta> tags required. 

On the server-side, you can request the post data and fill the tags.

URL to a post (the same one used by the default bulletinProviders):

https://livecentercdn.norkon.net/Bulletin/{tenantKey}/{bulletinId}/{channelId}

As a performance boost, you can use the data located in the "result" property of the JSON object returned by that endpoint and pass it to the front-end code to avoid having to request it again on the front-end.

Front-end example with existing backend code:

var linkedBulletinId = <from backend>;
var linkedPostData = <"result" property of the JSON object requested on the backend>;

//Start the feed 
var feedControl = NcPosts.start({...});
var linkedPost = feedControl.listManager.postFactory(linkedBulletinId);
linkedPost.update(linkedPostData);
document.getElementById("linked-post").appendChild(linkedPost.postContainer);

Updating of a linked post

If you want any updates coming in to be reflected in a linked post rendered outside the automatically managed list, you can add a hook on the "options" object you pass in to NcPosts.start. The property "updateReceived" can be set to a function that will be called on each update the client gets from the server.

Example updateReceived function:

options.updateReceived = function(d){
   //Go through the array of added or changed posts
   if (d.addedOrChanged){ 
      for (var i = 0; i < d.addedOrChanged.length; i++) {
         if (d.addedOrChanged[i].id === linkedBulletinId) {
            linkedPost.update(d.addedOrChanged[i]);
            break;
      }
   }
};
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? How can we help? How can we help?