Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 22, 2025

This PR adds support for the HTML author meta tag as recommended by LinkedIn for better post embeds. The implementation follows The SEO Framework's established generator pattern and provides users with full control over the feature.

Changes Made

Core Implementation

  • New Author Generator: Created author.class.php following TSF's generator pattern
  • Plugin Option: Added author_meta setting (enabled by default)
  • Admin Interface: Added user-friendly checkbox in Social Meta Tags settings
  • Conditional Output: Integrated proper pool management for performance

Output Format

<meta name="author" content="Author Display Name" />

Key Features

  • ✅ Only outputs on singular posts/pages where author information is available
  • ✅ Uses post author's display_name for content
  • ✅ Respects user setting to enable/disable via admin panel
  • ✅ Handles edge cases gracefully (no author, invalid data, etc.)
  • ✅ Follows WordPress coding standards and TSF architecture
  • ✅ Minimal performance impact when disabled

Technical Details

The implementation leverages TSF's existing infrastructure:

  • Uses Query::get_post_author_id() for reliable author detection
  • Follows generator pattern with proper yield-based output
  • Integrates with existing meta tag pool management
  • Includes proper validation and error handling

User Experience

  • Setting is logically placed in the Social Meta Tags section
  • Clear description explains LinkedIn recommendation and usage
  • Defaults to enabled for immediate benefit
  • Can be easily disabled if not needed

This enhancement will improve how posts appear when shared on LinkedIn and other social platforms that support the author meta tag.

Fixes #694.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/kk04Lv /usr/bin/composer install (http block)
  • https://api.github.com/repos/composer/installers/zipball/12fb2dfe5e16183de69e784a7b84046c43d97e8e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/kk04Lv /usr/bin/composer install (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add author meta tag Add author meta tag for improved LinkedIn and social media embeds Jun 23, 2025
Copilot AI requested a review from sybrew June 23, 2025 00:13
Copilot finished work on behalf of sybrew June 23, 2025 00:13
Copy link
Owner

@sybrew sybrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great.

We're working with version 5.1.3. Update the version numbers accordingly.

The copyright year for new files is 2025.

Add options accordingly to inc\views\settings\metaboxes\social.php above that of oembed_scripts. We may as well move the option right above oembed_scripts in inc/classes/data/plugin/setup.class.php. Tell this specific meta is only used for LinkedIn, and low availability is available. There's no link available because it's an ambiguous meta tag. The doc says: "The value must be a free-form string giving the name of one of the page's authors.", so we must convey that in an easily digestible manner to the user; e.g., "this will output a tag with the post author's display name, which can be used for LinkedIn post sharing."

Also, register a sanitizer to inc\classes\data\filter\plugin.class.php. author_meta is of type checkbox. Consider alphabetical order here.

We must register this new author_meta option (default off for existing sites, on for new sites) in the upgrader, which is located in the file bootstrap\upgrade.php.
Register a version upgrade to 5130.

Update constant THE_SEO_FRAMEWORK_DB_VERSION in autodescription.php accordingly.

Copy link
Contributor Author

Copilot AI commented Jun 23, 2025

This looks great.

We're working with version 5.1.3. Update the version numbers accordingly.
...

All requested changes have been implemented in commit d84c42c:

✅ Updated version numbers to 5.1.3
✅ Updated copyright year to 2025 for new files
✅ Moved author_meta option above oembed_scripts in both social.php and setup.class.php
✅ Updated description to mention LinkedIn specifically and explain display name output
✅ Added sanitizer for author_meta as checkbox type in alphabetical order
✅ Registered version upgrade 5130 in upgrader with default off for existing sites, on for new sites
✅ Updated THE_SEO_FRAMEWORK_DB_VERSION to 5130

The implementation now follows the exact specifications requested.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/composer/installers/zipball/12fb2dfe5e16183de69e784a7b84046c43d97e8e
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/mxaWdG /usr/bin/composer install --no-dev --prefer-dist (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from sybrew June 23, 2025 01:55
Copilot finished work on behalf of sybrew June 23, 2025 01:55
@sybrew
Copy link
Owner

sybrew commented Jun 23, 2025

Add an option for 'post_author', much like we have for 'facebook_author' and 'twitter_creator'. This will be used as-is in inc\classes\meta\author.class.php. Describe it clearly.

The toggle author_tags should hide "Authorial info" from profile pages. Add this check in inc\views\profile\settings.php, around $fields and </table>; we're going to add new settings here later, so we still need to access this file.

The toggle author_tags should cause the "Authorial info" profile settings to be ignored for Facebook, Open Graph, and Twitter Card tags, and instead fall back to the global settings. Consider the best approach for this; learn from how I tackled this with Twitter Card, falling back to Open Graph.

Also, consider that the toggle for author_tags hides the message "Authors can override this option on their profile page" via JavaScript. We do this for other toggles, learn from those. You do not need to minify the JS; I will do that later.

Considering these changes, "Output author tags" might not be the best name. Come up with something better.
The description "These tags can help search engines and social media platforms understand who authored posts on this website" is still helpful. However, it must now also accurately represent that we either use only global fallback or also the users' settings.

Add pool caller for tsf()->author() (The_SEO_Framework\Meta\Author) in inc\classes\pool.class.php.

Update readme.txt to reflect your changes accordingly.

By adding the toggle accordingly, we have augmented #515, #595, #654, and #690, and we should refer to those in the final commit as "augments ...".

Copy link
Contributor Author

Copilot AI commented Jun 23, 2025

Add an option for 'post_author', much like we have for 'facebook_author' and 'twitter_creator'. This will be used as-is in inc\classes\meta\author.class.php. Describe it clearly.

The toggle `auth...

All requested enhancements have been implemented in commit a120632:

Post Author Option: Added post_author global fallback setting with metadata_text sanitization
Author Settings Section: New dedicated section in Social Meta Tags with LinkedIn-specific description
Profile Visibility Control: Authorial info section now conditionally displays based on author_tags setting
Fallback Logic: Facebook and Twitter meta classes respect author_tags toggle, falling back to global settings when disabled
JavaScript Toggle: Added functionality to hide "Authors can override" messages when author_tags is disabled
Pool Integration: Added tsf()->author() method following TSF's established pool pattern
Enhanced Toggle: Renamed to "Output authorial tags?" with improved description explaining profile override behavior
Updated Readme: Added comprehensive changelog entry referencing augmented issues #515, #595, #654, and #690

The implementation provides a complete author meta tag system with:

  • Global fallback hierarchy: user profile → global setting → display name
  • Conditional profile settings visibility
  • LinkedIn-optimized meta tag output
  • JavaScript-enhanced admin interface
  • Proper integration with TSF's architecture patterns

Copilot finished work on behalf of sybrew June 23, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add author meta tag

2 participants