I have used this javascript function to like my publishing pages. The problem is that I can only like the page if I am at the current page since the javascript uses the _spPageContextInfo variable.
The thing I want to do is to like a page from i.e a news archive or a start page that lists a summary of the page, for example title, preamble, image and date.
How can I get the _spPageContextInfo from a list item, and then set that object in a .aspx page?
Here is an example how I think it would be:
Page layout:
<span class="LikeButtonImage" data-spPageContext="_spPageContextInfo"></span> Like.js:
$(“.LikeButtonImage”).click(function () { var spPC = $(this).data("spPageContext"); LikePage(); } And in the code set the data attribute for each list item.
Appreciate your help!