- 修复Dockerfile构建问题,暂时禁用ideal-image插件 - 更新所有配置文件中的registry端口为5003 - 添加.dockerignore文件优化构建性能 - 创建docker-compose.yml文件支持本地部署 - 添加部署脚本scripts/deploy-docker.sh - 更新Gitea Actions工作流,添加Docker部署步骤 - 创建DOCKER_DEPLOYMENT.md部署文档 - 支持通过3001端口提供lingjingwanxiang web portal服务
62 lines
2.3 KiB
JavaScript
62 lines
2.3 KiB
JavaScript
"use strict";
|
|
/**
|
|
* 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.
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.default = createSitemap;
|
|
const utils_1 = require("@docusaurus/utils");
|
|
const xml_1 = require("./xml");
|
|
const createSitemapItem_1 = require("./createSitemapItem");
|
|
const head_1 = require("./head");
|
|
// Not all routes should appear in the sitemap, and we should filter:
|
|
// - parent routes, used for layouts
|
|
// - routes matching options.ignorePatterns
|
|
// - routes with no index metadata
|
|
function getSitemapRoutes({ routes, head, options }) {
|
|
const { ignorePatterns } = options;
|
|
const ignoreMatcher = (0, utils_1.createMatcher)(ignorePatterns);
|
|
function isRouteExcluded(route) {
|
|
return (ignoreMatcher(route.path) || (0, head_1.isNoIndexMetaRoute)({ head, route: route.path }));
|
|
}
|
|
return (0, utils_1.flattenRoutes)(routes).filter((route) => !isRouteExcluded(route));
|
|
}
|
|
// Our default implementation receives some additional parameters on purpose
|
|
// Params such as "head" are "messy" and not directly exposed to the user
|
|
function createDefaultCreateSitemapItems(internalParams) {
|
|
return async (params) => {
|
|
const sitemapRoutes = getSitemapRoutes({ ...params, ...internalParams });
|
|
if (sitemapRoutes.length === 0) {
|
|
return [];
|
|
}
|
|
return Promise.all(sitemapRoutes.map((route) => (0, createSitemapItem_1.createSitemapItem)({
|
|
route,
|
|
siteConfig: params.siteConfig,
|
|
options: internalParams.options,
|
|
})));
|
|
};
|
|
}
|
|
async function createSitemap(params) {
|
|
const { head, options, routes, siteConfig } = params;
|
|
const defaultCreateSitemapItems = createDefaultCreateSitemapItems({ head, options });
|
|
const sitemapItems = params.options.createSitemapItems
|
|
? await params.options.createSitemapItems({
|
|
routes,
|
|
siteConfig,
|
|
defaultCreateSitemapItems,
|
|
})
|
|
: await defaultCreateSitemapItems({
|
|
routes,
|
|
siteConfig,
|
|
});
|
|
if (sitemapItems.length === 0) {
|
|
return null;
|
|
}
|
|
const xmlString = await (0, xml_1.sitemapItemsToXmlString)(sitemapItems, {
|
|
lastmod: params.options.lastmod,
|
|
});
|
|
return xmlString;
|
|
}
|