File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,11 @@ protected function findPriorityInConfig(string $slug): int
36
36
return 500 ;
37
37
}
38
38
39
- return array_search ($ slug , $ orderIndexArray ); // + 250?
39
+ return array_search ($ slug , $ orderIndexArray ) + 250 ;
40
+
41
+ // Adding 250 makes so that pages with a front matter priority that is lower
42
+ // can be shown first. It's lower than the fallback of 500 so that they
43
+ // still come first. This is all to make it easier to mix priorities.
40
44
}
41
45
42
46
public function isHidden (): bool
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ public function test_sidebar_item_priority_set_in_config_overrides_front_matter(
132
132
$ this ->assertEquals (25 , DocumentationSidebarService::get ()->first ()->priority );
133
133
}
134
134
135
- public function test_both_sidebar_priority_setting_methods_can_be_used ()
135
+ public function test_sidebar_priorities_can_be_set_in_both_front_matter_and_config ()
136
136
{
137
137
Config::set ('hyde.documentationPageOrder ' , [
138
138
'first ' ,
@@ -142,7 +142,7 @@ public function test_both_sidebar_priority_setting_methods_can_be_used()
142
142
touch (Hyde::path ('_docs/first.md ' ));
143
143
touch (Hyde::path ('_docs/second.md ' ));
144
144
file_put_contents (Hyde::path ('_docs/third.md ' ),
145
- (new ConvertsArrayToFrontMatter )->execute (['priority ' => 3 ])
145
+ (new ConvertsArrayToFrontMatter )->execute (['priority ' => 300 ])
146
146
);
147
147
$ sidebar = DocumentationSidebarService::get ();
148
148
$ this ->assertEquals ('first ' , $ sidebar [0 ]->destination );
You can’t perform that action at this time.
0 commit comments