LinkedIn Cross-post ID broken

I have a bug where Params.linkedin.id is not returning the correct ID for the cross-post - it goes to a 404-not found.

Here’s my Hugo partial for syndication links:

{{ if or ( .Params.bluesky ) ( .Params.linkedin ) }}
<span class="syndication">
    {{ if .Params.bluesky.url }}
    <a class="u-syndication icon fa-brands fa-bluesky" {{ printf "href=%q" .Params.bluesky.link | safeHTMLAttr }} ></a>
    {{ end }}  
    {{ if .Params.linkedin.id }}
    <a class="u-syndication icon fa-brands fa-linkedin" href="https://www.linkedin.com/feed/update/urn:li:activity:{{ ( print .Params.linkedin.id ) | safeHTMLAttr }}" ></a>    {{ end }}
</span> 
{{ end }}

Link generated by Params.LinkedIn.id is: Sign Up | LinkedIn

Correct link is:

Does anyone know why the ID doesn’t seem to return the correct value?

Screenshot of the working post link:

Thanks for reporting this! I’ve dug into it and see that LinkedIn is returning two separate IDs to us. There is the share ID for the post response that we are currently saving, and there is another “activity” URI.

I’m not sure if this was a change or just something we never fully understood. I can’t get LinkedIn to recognize the share ID.

To avoid breaking anything further, I’m going to add a new field that is available to Hugo templates: .Params.linkedin.activity that is the format “urn:li:activity:12345”.

The change will be live today.

1 Like

Hi Manton,

Thank you for working on this.

Is there any way to get this working for historical posts? A new post works great, but older posts seem to have the .Params.linkedin.activity missing: https://www.linkedin.com/feed/update/<nil>/

{{ if or ( .Params.bluesky ) ( .Params.linkedin ) }}
<span class="syndication">
    {{ if .Params.bluesky.url }}
    <a class="u-syndication icon fa-brands fa-bluesky" {{ printf "href=%q" .Params.bluesky.link | safeHTMLAttr }} ></a>
    {{ end }}  
    {{ if .Params.linkedin.id }}
    <a class="u-syndication icon fa-brands fa-linkedin" href="https://www.linkedin.com/feed/update/{{ ( print .Params.linkedin.activity ) | safeHTMLAttr }}" ></a>    {{ end }}
</span> 
{{ end }} 

New post with working link: Charlotte Brooks

Old post with non-working link: Charlotte Brooks

For now I would change the if .Params.linkedin.id to check .Params.linkedin.activity instead. That way if it’s blank for older posts, it just won’t show the link to LinkedIn.

There might be a way for us to rebuild the historical post data using the LinkedIn API, but I’m not sure yet.