Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ New Inline Format ] Introduce Inline Time Format for improved SEO and accessibility #67751

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

sarthaknagoshe2002
Copy link
Contributor

Partial Fix for : #54488

What?

This PR introduces a Time Inline Format to display time or date information with machine-readable formatting using the <time> element.

Why?

The <time> element with the datetime attribute improves machine-readability, providing better SEO and more accurate metadata for search engines.
While similar functionality exists in core blocks like Post Date or Latest Comments, these options are tied to specific content. This new feature allows inline time representation without creating additional content types.

How?

  • Enables inline application of <time> formatting within text, like in a Paragraph block.
  • Cleans & adds the selected value in the datetime attribute.

Testing Instructions

  1. Add text in a Paragraph block.
  2. Apply the Time Inline Format to a portion of the text and configure the datetime attribute.
  3. Verify the inline time is applied with accurate attributes.
  4. Confirm output improves metadata and accessibility in SEO-related tools.

Screenshots or screencast

Inline.time.format.mov

Copy link

github-actions bot commented Dec 9, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sarthaknagoshe2002 <[email protected]>
Co-authored-by: ellatrix <[email protected]>
Co-authored-by: t-hamano <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ellatrix ellatrix added the [Type] Enhancement A suggestion for improvement. label Dec 10, 2024
@ellatrix ellatrix added the [Package] Format library /packages/format-library label Dec 10, 2024
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

@sarthaknagoshe2002 Thanks for the PR!

The important point here is that generating the datetime attribute from a selected string can be difficult:

  • The user won't necessarily enter the correct date and time according to the ISO format.
  • The text won't necessarily be in English. For example, 14:00 UTC +5:30 15th December 2024 will become 2024年12月15日 14時(UTC+5:30) in Japanese.

Given that, I think it would be better for the user to explicitly select the date and time, like so:

268183239-538af810-542a-4bb9-8118-3625f8bca94b

@sarthaknagoshe2002
Copy link
Contributor Author

The important point here is that generating the datetime attribute from a selected string can be difficult:

  • The user won't necessarily enter the correct date and time according to the ISO format.
  • The text won't necessarily be in English. For example, 14:00 UTC +5:30 15th December 2024 will become 2024年12月15日 14時(UTC+5:30) in Japanese.

Given that, I think it would be better for the user to explicitly select the date and time, like so:

@t-hamano Noted, on it!

@sarthaknagoshe2002
Copy link
Contributor Author

@t-hamano I’ve implemented the picker as advised. Could you please take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Format library /packages/format-library [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants