File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
packages/framework/src/Framework/Features/XmlGenerators Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -61,28 +61,34 @@ protected function getLastModDate(string $file): string
6161 return date ('c ' , @Filesystem::lastModified ($ file ) ?: Carbon::now ()->timestamp );
6262 }
6363
64+ /** Intelligently find a good priority for the given page based on assumptions about the site structure. */
6465 protected function getPriority (string $ pageClass , string $ identifier ): string
6566 {
6667 // The default priority, unless we find a better match.
6768 $ priority = 0.5 ;
6869
6970 if (in_array ($ pageClass , [BladePage::class, MarkdownPage::class])) {
71+ // These pages are usually high up in the site hierarchy, so they get a higher priority.
7072 $ priority = 0.9 ;
7173
7274 if ($ identifier === 'index ' ) {
75+ // The homepage is the most important page, so it gets the highest priority.
7376 $ priority = 1 ;
7477 }
7578 }
7679
7780 if ($ pageClass === DocumentationPage::class) {
81+ // If a site has documentation pages, they are usually important as well.
7882 $ priority = 0.9 ;
7983 }
8084
8185 if ($ pageClass === MarkdownPost::class) {
86+ // Posts are usually less important than pages as there may be many of them.
8287 $ priority = 0.75 ;
8388 }
8489
8590 if ($ identifier === '404 ' ) {
91+ // 404 pages are rarely important to index, so they get a lower priority.
8692 $ priority = 0.5 ;
8793 }
8894
You can’t perform that action at this time.
0 commit comments