Skip to content

Instantly share code, notes, and snippets.

@nicc
Created May 1, 2018 14:24
Show Gist options
  • Save nicc/4939de77fa8e4f6cc2892d76b9d36af5 to your computer and use it in GitHub Desktop.
Save nicc/4939de77fa8e4f6cc2892d76b9d36af5 to your computer and use it in GitHub Desktop.
var React = require("react");
var ContentItemComponent = React.createClass({
getInitialState: function() {
return {
contentItemId: "YOUR_CONTENT_ITEM_ID"
};
},
componentDidMount: function() {
this.initRelatedContentModule();
},
initRelatedContentModule: function() {
Bibblio.initRelatedContent({
targetElementId: 'my-bibblio-container',
recommendationKey: "YOUR_RECOMMENDATION_KEY",
contentItemId: this.state.contentItemId
// customUniqueIdentifier: getParameterByName('customUniqueIdentifier'), // Required if no contentItemId is provided. Also required if autoIngestion is enabled.
// autoIngestion: true, // Requires a customUniqueIdentifier. Default: false.
// catalogueIds: ["a8365ab1-00f9-38f8-af51-4d0ff527856f"], // Default: same as content item.
// userId: "42", // Default: nil.
// queryStringParams: { "utm_source" : "BibblioRCM" }, // Appends 'utm_source=BibblioRCM' to recommended urls
// subtitleField: 'provider.name' // Default: headline. passing a value of false will disable the subtitle completely
// styleClasses: "bib--grd-4 bib--wide" // Default: 'bib--box-6 bib--wide'
});
},
render: function() {
return (
<div>
<h1>Related Content</h1>
<div id="my-bibblio-container">
</div>
</div>
);
}
});
module.exports = ContentItemComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment