Attach link previews on LinkedIn and Facebook text posts - #367
Open
paulocastellano wants to merge 15 commits into
Open
paulocastellano wants to merge 15 commits into
paulocastellano wants to merge 15 commits into
Conversation
added 15 commits
September 21, 2026 16:56
Neither API unfurls a URL left in the caption: LinkedIn needs an article payload, and Facebook only scrapes when the Page feed post sets link. A text-only post now sends that card from the first URL, and the editor preview shows it.
facebook.com, fb.com and fb.me are no longer sent as the Page feed link, and a scrape or invalid-URL error retries once without the card. LinkedIn still publishes the text if the preview lookup fails, and the thumbnail download stays off private hosts.
The editor now skips facebook.com, fb.com and fb.me the same way the publisher does, and a link rejection that is retried as plain text is no longer logged as a failed post.
… of the publisher.
…h each. The LinkedIn article thumbnail shares the optimize-and-upload step with regular image posts instead of carrying its own copy, and each method removes only the temp file it created. The Facebook text post with a link lives in its own method, so the retry without the link reads top to bottom.
The publisher asks rejectsLink() instead of comparing Graph codes inline; the codes live next to the rest of the Facebook error table.
Title and description trimming, a non-image og:image, a dead token during the thumbnail upload, the article under a company page, a retry that fails too, and a dead token on the first Facebook attempt.
A slow preview used to revive a card the user had already removed, or overwrite the card of the link they typed next. The response now only lands when the URL it was fetched for is still the one in the caption.
Changing the caption URL now clears the old card immediately and bumps a request id so an in-flight response cannot land on the wrong caption. The LinkedIn image/thumbnail path also refuses a failed tempnam or fopen instead of feeding false into unlink.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
content.article) with the Open Graph title, description, and thumbnail. The Posts API does not scrape URLs on its own.linkparameter, which is what makes Facebook render the preview. If the scrape fails (1609005), the post is published again without the card.Test plan