fix(route/latepost): include cover image and abstract in description - #23121
Open
esonwong wants to merge 1 commit into
Open
fix(route/latepost): include cover image and abstract in description#23121esonwong wants to merge 1 commit into
esonwong wants to merge 1 commit into
Conversation
The article body selector `#select-main` excludes the cover image, which the site renders in a sibling block. As a result feed items never carried the cover, even though every recent exclusive and long read has one. Pick it up from `#abstract_img` (exclusives, long reads) or `img.interview-pic` (interviews), falling back to the share image declared in the page script so both layouts are covered. The site serves these over plain http, so upgrade the scheme — readers on https tend to refuse mixed content. Articles genuinely without a cover, such as those in the 晚点早知道 column, are left untouched. Also prepend the one-line abstract that accompanies the cover, which was likewise dropped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Auto Review
|
Contributor
|
Successfully generated as following: http://localhost:1200/latepost - Failed ❌http://localhost:1200/latepost/1 - Failed ❌http://localhost:1200/latepost/2 - Failed ❌http://localhost:1200/latepost/3 - Failed ❌http://localhost:1200/latepost/4 - Failed ❌ |
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.
Involved Issue / 该 PR 相关 Issue
Close #
Example for the Proposed Route(s) / 路由地址示例
New RSS Route Checklist / 新 RSS 路由检查表
PuppeteerNote / 说明
This is a fix to an existing route, not a new one — the checklist above is left blank on purpose.
What was wrong
item.descriptionis built from#select-main, which is the article body only. The cover image sits outside it, in a sibling block, so feed items never included it even though nearly every recent article has one.The two layouts
The site uses different markup depending on the column:
proma1, 4)<img id="abstract_img">inside.abstractproma2)<img class="interview-pic">proma3)Handling only the first selector would have missed every interview, so the patch tries both and then falls back to the
var imgUrlshare image declared in the page script, which is present exactly when a cover exists and absent otherwise.Scheme upgrade
The cover is served as
http://www.latepost.com/uploads/cover/...while the body images use https. Readers rendering the item over https may refuse the mixed content, so the scheme is upgraded. The body images are unaffected.Abstract
The one-line abstract shown next to the cover (
.abstract-pic-left) was dropped as well; it is now prepended as a<blockquote>.Verification
Checked against saved copies of 11 real articles spanning all four columns:
#abstract_imgimg.interview-pic<img>Articles that genuinely have no cover produce the same description as before.