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

SEO Tools: add archive_title page title token #56084

Merged
merged 7 commits into from
Sep 10, 2021
Merged

Conversation

samiff
Copy link
Contributor

@samiff samiff commented Sep 7, 2021

Changes proposed in this Pull Request

Related (prerequisite): Automattic/jetpack#20920

This PR:

  • Supports adding & previewing a more generic archive_title token for custom Archive page titles.
  • Hides the Date token button for Archives (but we still tokenize existing [date] usage).
  • The Date button will only be replaced with the Archive Title button on Jetpack versions >= 10.2-alpha

Testing instructions


Screenshot for Translators:

Markup on 2021-09-10 at 13:33:55

@samiff samiff added Jetpack [Status] In Progress [Feature] SEO Tools Tools for improving a site's search engine optimization. labels Sep 7, 2021
@samiff samiff self-assigned this Sep 7, 2021
@github-actions
Copy link

github-actions bot commented Sep 7, 2021

@matticbot
Copy link
Contributor

matticbot commented Sep 7, 2021

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~10 bytes added 📈 [gzipped])

name          parsed_size           gzip_size
posts-custom        +33 B  (+0.0%)      +10 B  (+0.0%)
posts               +33 B  (+0.0%)      +10 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~179 bytes added 📈 [gzipped])

name                                                         parsed_size           gzip_size
async-load-calypso-my-sites-site-settings-seo-settings-form       +700 B  (+0.2%)     +160 B  (+0.2%)
async-load-design-blocks                                           +33 B  (+0.0%)      +10 B  (+0.0%)
async-load-calypso-components-web-preview-component                +33 B  (+0.0%)       +9 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Otherwise, a WPorg JP site on say 10.1 would see the option to add an
Archive Title in Calypso, but it would fail at saving it.
@samiff samiff requested a review from jeherve September 9, 2021 20:52
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Sep 9, 2021
@samiff
Copy link
Contributor Author

samiff commented Sep 9, 2021

@jeherve Does the version check added in e4e21fa look ok?

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

Does the version check added in e4e21fa look ok?

Yup. Although you could use the isJetpackMinimumVersion utility, to have less work to do?

/**
* Returns true if the Jetpack site is running a version meeting the specified
* minimum, or false if the Jetpack site is running an older version. Returns
* null if the version cannot be determined or if not a Jetpack site.
*
* @param {object} state Global state tree
* @param {number} siteId Site ID
* @param {string} version Minimum version
* @returns {?boolean} Whether running minimum version
*/
export default function isJetpackMinimumVersion( state, siteId, version ) {

@jeherve jeherve added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Sep 10, 2021
@samiff
Copy link
Contributor Author

samiff commented Sep 10, 2021

Although you could use the isJetpackMinimumVersion utility, to have less work to do?

Thanks! Totally missed that one.

@samiff samiff merged commit 50dc6b4 into trunk Sep 10, 2021
@samiff samiff deleted the add/seo-archive-title branch September 10, 2021 18:43
@samiff samiff restored the add/seo-archive-title branch September 10, 2021 19:12
@a8ci18n
Copy link

a8ci18n commented Sep 10, 2021

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/6581579

Thank you @samiff for including a screenshot in the description! This is really helpful for our translators.

@samiff samiff deleted the add/seo-archive-title branch September 10, 2021 19:18
@samiff
Copy link
Contributor Author

samiff commented Sep 10, 2021

@jeherve Small snag here, isJetpackMinimumVersion or fetching getSiteOption( state, siteId, 'jetpack_version' ) won't return truthy for a WPcom non-AT Business plan site which should have the SEO settings.

Would this work, or is there a better way?

	let shouldShowSeoArchiveTitleButton = false;
	if ( isJetpackMinimumVersion( state, siteId, '10.2-alpha' ) ) {
		shouldShowSeoArchiveTitleButton = true;
	} else if (
		! isJetpackSite( state, siteId ) &&
		hasActiveSiteFeature( state, siteId, FEATURE_ADVANCED_SEO )
	) {
		// For non-AT Business plan sites which get SEO features.
		shouldShowSeoArchiveTitleButton = true;
	}

@jeherve
Copy link
Member

jeherve commented Sep 13, 2021

Yeah, that sounds good to me.

@a8ci18n
Copy link

a8ci18n commented Sep 17, 2021

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] SEO Tools Tools for improving a site's search engine optimization. Jetpack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants