WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 206327
Add support for categories and custom post types to the social meta plugin
https://bugs.webkit.org/show_bug.cgi?id=206327
Summary
Add support for categories and custom post types to the social meta plugin
Jon Davis
Reported
2020-01-15 17:05:05 PST
Update the social meta plugin to support generic blog archive categories and custom post type archives.
Attachments
Patch
(4.41 KB, patch)
2020-01-15 17:13 PST
,
Jon Davis
no flags
Details
Formatted Diff
Diff
Patch
(7.25 KB, patch)
2020-01-16 11:19 PST
,
Jon Davis
no flags
Details
Formatted Diff
Diff
Patch
(7.70 KB, patch)
2020-01-16 13:28 PST
,
Jon Davis
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Jon Davis
Comment 1
2020-01-15 17:13:12 PST
Created
attachment 387874
[details]
Patch
Devin Rousso
Comment 2
2020-01-15 17:26:38 PST
Comment on
attachment 387874
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=387874&action=review
r=me
> Websites/webkit.org/wp-content/plugins/social-meta.php:35 > + $description = get_bloginfo('name') . " blog archive.";
NIT: should we use "category" instead of `is_category()`?
> Websites/webkit.org/wp-content/plugins/social-meta.php:42 > + $url = get_category_link($category_term_id);
Should we only override `$url` if `get_category_link(...)` returns a non-empty string (which indicates an error)?
> Websites/webkit.org/wp-content/plugins/social-meta.php:49 > + $post_type_obj = get_post_type_object( $post_type );
Style: extra spacing around `(` and `)`
> Websites/webkit.org/wp-content/plugins/social-meta.php:50 > +
Style: unnecessary newline
> Websites/webkit.org/wp-content/plugins/social-meta.php:51 > + if ( isset( $post_type_obj->description ) )
Ditto (49) Also, should we null-check `$post_type_obj` too in case there was an error?
> Websites/webkit.org/wp-content/plugins/social-meta.php:54 > + $url = get_post_type_archive_link($post_type);
Ditto (42)
Jon Davis
Comment 3
2020-01-16 11:19:47 PST
Created
attachment 387935
[details]
Patch
Devin Rousso
Comment 4
2020-01-16 11:43:17 PST
Comment on
attachment 387935
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=387935&action=review
r=me, but this needs to be rebased
> Websites/webkit.org/wp-content/plugins/social-meta.php:32 > + $description = "A repository of all ".get_bloginfo('name')."blog posts.";
Style: I think we should have spaces around `.` Also, I think there should be a space before "blog".
> Websites/webkit.org/wp-content/plugins/social-meta.php:48 > + $title = get_bloginfo('name')." Blog ".get_the_archive_title(); > + $description = "A collection of ".get_bloginfo('name')." blog posts.";
Ditto (32)
> Websites/webkit.org/wp-content/plugins/social-meta.php:60 > + preg_match_all('/<img.+src(set)?=[\'"]([^\s\'"]+).*[\'"].*>/i', $post->post_content, $matches);
This means that we will never use dark mode images. Is that OK, or do we prefer that instead?
> Websites/webkit.org/wp-content/plugins/social-meta.php:61 > + if (isset($matches[2][0])) $image_url = $matches[2][0];
Style: please put the body of the `if` on a separate line.
Jon Davis
Comment 5
2020-01-16 13:28:38 PST
Created
attachment 387950
[details]
Patch
Devin Rousso
Comment 6
2020-01-16 13:44:27 PST
Comment on
attachment 387950
[details]
Patch r=me, thanks for iterating!
WebKit Commit Bot
Comment 7
2020-01-16 14:26:50 PST
Comment on
attachment 387950
[details]
Patch Clearing flags on attachment: 387950 Committed
r254709
: <
https://trac.webkit.org/changeset/254709
>
WebKit Commit Bot
Comment 8
2020-01-16 14:26:51 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9
2020-01-16 14:27:15 PST
<
rdar://problem/58658007
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug