Skip to content

Commit

Permalink
Merge pull request #21665 from Yoast/fix-seo-optimization-button-in-a…
Browse files Browse the repository at this point in the history
…lerts

Fix seo optimization button in alerts
  • Loading branch information
vraja-pro authored Oct 1, 2024
2 parents b251a07 + 0d81188 commit 7e1e5b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
13 changes: 12 additions & 1 deletion css/src/new-dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ body.toplevel_page_wpseo_dashboard {
yst-text-xs
yst-leading-4
yst-px-2.5
yst-py-1.5;
yst-py-1.5

/* custom for general page */
yst-mt-3;
}

.button-link {
Expand All @@ -233,6 +236,14 @@ body.toplevel_page_wpseo_dashboard {
visited:yst-text-primary-500
visited:hover:yst-text-primary-400;
}

.ul-disc{
@apply
yst-list-disc
yst-pl-3
yst-ml-3
yst-mt-1.5;
}
}
}
/* RTL */
Expand Down
18 changes: 9 additions & 9 deletions src/presenters/admin/indexing-notification-presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public function __construct( $short_link_helper, $total_unindexed, $reason ) {
* @return string The HTML string representation of the notification.
*/
public function present() {
$notification_text = '<p>' . $this->get_message( $this->reason ) . '</p>';
$notification_text .= '<p>' . $this->get_time_estimate( $this->total_unindexed ) . '</p>';
$notification_text = '<p>' . $this->get_message( $this->reason );
$notification_text .= $this->get_time_estimate( $this->total_unindexed ) . '</p>';
$notification_text .= '<a class="button" href="' . \get_admin_url( null, 'admin.php?page=wpseo_tools&start-indexation=true' ) . '">';
$notification_text .= \esc_html__( 'Start SEO data optimization', 'wordpress-seo' );
$notification_text .= '</a>';
Expand Down Expand Up @@ -84,16 +84,16 @@ protected function get_message( $reason ) {
$text = \esc_html__( 'Because of a change in your tag base setting, some of your SEO data needs to be reprocessed.', 'wordpress-seo' );
break;
case Indexing_Reasons::REASON_POST_TYPE_MADE_PUBLIC:
$text = \esc_html__( 'We need to re-analyze some of your SEO data because of a change in the visibility of your post types. Please help us do that by running the SEO data optimization. ', 'wordpress-seo' );
$text = \esc_html__( 'We need to re-analyze some of your SEO data because of a change in the visibility of your post types. Please help us do that by running the SEO data optimization.', 'wordpress-seo' );
break;
case Indexing_Reasons::REASON_TAXONOMY_MADE_PUBLIC:
$text = \esc_html__( 'We need to re-analyze some of your SEO data because of a change in the visibility of your taxonomies. Please help us do that by running the SEO data optimization. ', 'wordpress-seo' );
$text = \esc_html__( 'We need to re-analyze some of your SEO data because of a change in the visibility of your taxonomies. Please help us do that by running the SEO data optimization.', 'wordpress-seo' );
break;
case Indexing_Reasons::REASON_ATTACHMENTS_MADE_ENABLED:
$text = \esc_html__( 'It looks like you\'ve enabled media pages. We recommend that you help us to re-analyze your site by running the SEO data optimization. ', 'wordpress-seo' );
$text = \esc_html__( 'It looks like you\'ve enabled media pages. We recommend that you help us to re-analyze your site by running the SEO data optimization.', 'wordpress-seo' );
break;
default:
$text = \esc_html__( 'You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. ', 'wordpress-seo' );
$text = \esc_html__( 'You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored.', 'wordpress-seo' );
}

/**
Expand All @@ -114,14 +114,14 @@ protected function get_message( $reason ) {
*/
protected function get_time_estimate( $total_unindexed ) {
if ( $total_unindexed < 400 ) {
return \esc_html__( 'We estimate this will take less than a minute.', 'wordpress-seo' );
return \esc_html__( ' We estimate this will take less than a minute.', 'wordpress-seo' );
}

if ( $total_unindexed < 2500 ) {
return \esc_html__( 'We estimate this will take a couple of minutes.', 'wordpress-seo' );
return \esc_html__( ' We estimate this will take a couple of minutes.', 'wordpress-seo' );
}

$estimate = \esc_html__( 'We estimate this could take a long time, due to the size of your site. As an alternative to waiting, you could:', 'wordpress-seo' );
$estimate = \esc_html__( ' We estimate this could take a long time, due to the size of your site. As an alternative to waiting, you could:', 'wordpress-seo' );
$estimate .= '<ul class="ul-disc">';
$estimate .= '<li>';
$estimate .= \sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function test_present_few_indexables() {
''
);

$expected = '<p>You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. </p><p>We estimate this will take less than a minute.</p><a class="button" href="https://example.org/wp-admin/admin.php?page=wpseo_tools">Start SEO data optimization</a>';
$expected = '<p>You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. We estimate this will take less than a minute.</p><a class="button" href="https://example.org/wp-admin/admin.php?page=wpseo_tools">Start SEO data optimization</a>';
$actual = $instance->present();

self::assertSame( $expected, $actual );
Expand All @@ -81,7 +81,7 @@ public function test_present_some_indexables() {
''
);

$expected = '<p>You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. </p><p>We estimate this will take a couple of minutes.</p><a class="button" href="https://example.org/wp-admin/admin.php?page=wpseo_tools">Start SEO data optimization</a>';
$expected = '<p>You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. We estimate this will take a couple of minutes.</p><a class="button" href="https://example.org/wp-admin/admin.php?page=wpseo_tools">Start SEO data optimization</a>';
$actual = $instance->present();

self::assertSame( $expected, $actual );
Expand Down Expand Up @@ -114,7 +114,7 @@ public function test_present_many_indexables() {
'A message to show in the notification.'
);

$expected = '<p>You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. </p><p>We estimate this could take a long time, due to the size of your site. As an alternative to waiting, you could:<ul class="ul-disc"><li>Wait for a week or so, until Yoast SEO automatically processes most of your content in the background.</li><li><a href="https://yoa.st/3-w?some-query-arg=some-value" target="_blank">Run the indexation process on your server</a> using <a href="https://wp-cli.org/" target="_blank">WP CLI</a>.</li></ul></p><a class="button" href="https://example.org/wp-admin/admin.php?page=wpseo_tools">Start SEO data optimization</a>';
$expected = '<p>You can speed up your site and get insight into your internal linking structure by letting us perform a few optimizations to the way SEO data is stored. We estimate this could take a long time, due to the size of your site. As an alternative to waiting, you could:<ul class="ul-disc"><li>Wait for a week or so, until Yoast SEO automatically processes most of your content in the background.</li><li><a href="https://yoa.st/3-w?some-query-arg=some-value" target="_blank">Run the indexation process on your server</a> using <a href="https://wp-cli.org/" target="_blank">WP CLI</a>.</li></ul></p><a class="button" href="https://example.org/wp-admin/admin.php?page=wpseo_tools">Start SEO data optimization</a>';
$actual = $instance->present();

self::assertSame( $expected, $actual );
Expand Down

0 comments on commit 7e1e5b1

Please sign in to comment.