mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-25 05:57:53 +02:00
feat(sitemap): add support for "lastmod" (#9954)
This commit is contained in:
parent
465cf4d82c
commit
9017fb9b1d
41 changed files with 1449 additions and 359 deletions
19
packages/docusaurus-utils/src/routeUtils.ts
Normal file
19
packages/docusaurus-utils/src/routeUtils.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {RouteConfig} from '@docusaurus/types';
|
||||
|
||||
/**
|
||||
* Recursively flatten routes and only return the "leaf routes"
|
||||
* Parent routes are filtered out
|
||||
*/
|
||||
export function flattenRoutes(routeConfig: RouteConfig[]): RouteConfig[] {
|
||||
function flatten(route: RouteConfig): RouteConfig[] {
|
||||
return route.routes ? route.routes.flatMap(flatten) : [route];
|
||||
}
|
||||
return routeConfig.flatMap(flatten);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue