Publish a page -> share it as a post on linkedin

I searched for “linkedin” on this forum and didn’t find anything, I hope it hasn’t been already answered. The closest I found was this post : Post-Publishing Hooks that has not been too helpful to me.

Here’s my thing : I’m ask by a client to make a website with job listings. There’ll be a couple of listings a month, and there’s no need for a big infrastructure, so Kirby is perfect. The thing is, he requires that all his listings are shared on Linkedin when he publishes them. I’m looking into how to go about that.

It has to do with hooks, doesn’t it ? Which hook should I use : or ? I haven’t seen anything about a post being specifically published. Created seems to me like the post has just been created as a draft, updated can be a change at any time… I want my Linkedin function to be called only when that new page is published for the first time.

Then, I’ll work with the Linkedin API, but that’s the focus of this forum.

Thanks !

1 Like

Making a page visible triggers the hook. Please make sure in your hook that each post is published only once. You can for example store the ID you get from LinkedIn together with the post (using $page->update()) and then check if an ID is set. You can also use the ID in the future together with the hook to update an existing post on LinkedIn.

1 Like

Neat ! Thanks :slight_smile:

Do I have to specify a field in the blueprint for the Linkedin ID I add through $page->update(), or can I add it without the field definition ? Will it be hidden from the editing page in the panel ?

You can add it without a field definition, if the field does not exist, is is created on $page->update(). If it is not defined, it will not be visible in the panel, though.


Thank you for the answers !