Hello guys,
Requirement: Show the LinkedIn button for a User that has the link set up in the DB or in Sitecore.
- First of all you can check out the LinkedIn Developer for what type of button you need and get the snippet code by clicking Get It. Really easy.
- I like this button sleek and cool https://developer.linkedin.com/plugins/member-profile-plugin-generator?button-type-logo-name=true
- From the box you can choose different actions for your button
- Then set a field in sitecore or set a field in the DB wherever you need it and a field for the name.
- I have added this in my html page:
<script src=”//platform.linkedin.com/in.js” type=”text/javascript”></script>
<script type=”IN/MemberProfile” data-id=”<%= LinkedInUrl%>” data-format=”hover” data-text=”<%= FullName%>”></script>
And in the code I set up the properties:
private string linkedInUrl;
protected string LinkedInUrl
{
get
{
if (!string.IsNullOrEmpty(linkedInUrl))
{
linkedInUrl = Sitecore.Context.Item[“LinkedInUrl”];
}
return linkedInUrl;
}
}
private string fullName;
protected string FullName
{
get
{
if (!string.IsNullOrEmpty(fullName))
{
fullName = Sitecore.Context.Item[“FullName”];
}
return fullName;
}
}
Now you can control what profile to show on your page. If you think there will be change and you don’t need the button anymore. You can set a visible property and a checkbox in Sitecore where you control to show or not the page.
Thank you,
VP