Commit 7ce9672 1 parent 032f1f2 commit 7ce9672 Copy full SHA for 7ce9672
File tree 2 files changed +9
-3
lines changed
plugins/speculation-rules
tests/plugins/speculation-rules
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ function plsr_get_speculation_rules() {
77
77
'source ' => 'document ' ,
78
78
'where ' => array (
79
79
'and ' => array (
80
- // Prerender any URLs within the same site.
80
+ // Include any URLs within the same site.
81
81
array (
82
82
'href_matches ' => $ prefixer ->prefix_path_pattern ( '/* ' ),
83
83
),
@@ -87,6 +87,12 @@ function plsr_get_speculation_rules() {
87
87
'href_matches ' => $ href_exclude_paths ,
88
88
),
89
89
),
90
+ // Also exclude rel=nofollow links, as plugins like WooCommerce attribute their add-to-cart links (which should buttons).
91
+ array (
92
+ 'not ' => array (
93
+ 'selector_matches ' => 'a[rel=nofollow] ' ,
94
+ ),
95
+ ),
90
96
),
91
97
),
92
98
'eagerness ' => $ eagerness ,
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ public function test_plsr_get_speculation_rules_prerender() {
100
100
$ rules = plsr_get_speculation_rules ();
101
101
102
102
$ this ->assertArrayHasKey ( 'prerender ' , $ rules );
103
- $ this ->assertCount ( 3 , $ rules ['prerender ' ][0 ]['where ' ]['and ' ] );
103
+ $ this ->assertCount ( 4 , $ rules ['prerender ' ][0 ]['where ' ]['and ' ] );
104
104
}
105
105
106
106
/**
@@ -112,7 +112,7 @@ public function test_plsr_get_speculation_rules_prefetch() {
112
112
$ rules = plsr_get_speculation_rules ();
113
113
114
114
$ this ->assertArrayHasKey ( 'prefetch ' , $ rules );
115
- $ this ->assertCount ( 2 , $ rules ['prefetch ' ][0 ]['where ' ]['and ' ] );
115
+ $ this ->assertCount ( 3 , $ rules ['prefetch ' ][0 ]['where ' ]['and ' ] );
116
116
}
117
117
118
118
/**
You can’t perform that action at this time.
0 commit comments