Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -1,10 +1,13 @@
|
||||
import type { EntryContext } from "react-router";
|
||||
import { getDomainRoutingConfig, type DomainRoutingConfig } from "@hivegrid/config";
|
||||
|
||||
import { defaultLocale } from "~/locale/i18n";
|
||||
import { enabledLocales } from "~/locale/i18next.server";
|
||||
import KnowledgeBaseServiceServer from "~/modules/knowledgeBase/service/KnowledgeBaseService.server";
|
||||
import KnowledgeBaseUtils from "~/modules/knowledgeBase/utils/KnowledgeBaseUtils";
|
||||
import { getAppConfiguration } from "./db/appConfiguration.db.server";
|
||||
import { i18nConfig } from "~/locale/i18n";
|
||||
import { getDomainRoutingConfig, type DomainRoutingConfig } from "@hivegrid/config";
|
||||
import { withPublicKnowledgeBaseRlsContext } from "~/modules/knowledgeBase/services/publicKnowledgeBaseRls.server";
|
||||
import { canonicalAdminRouteSlugs, normalizeRoutePath } from "./app/PublicRouteSegments";
|
||||
import { getAppConfiguration } from "./db/appConfiguration.db.server";
|
||||
import { createScopedLogger } from "./logger.server";
|
||||
|
||||
const sitemapLogger = createScopedLogger("sitemap");
|
||||
@@ -22,7 +25,14 @@ function getSitemapDomainUrl(config: DomainRoutingConfig = getDomainRoutingConfi
|
||||
}
|
||||
|
||||
function shouldSkipSitemapRouteId(id: string) {
|
||||
return id === "root" || id.startsWith("routes/_") || id.startsWith("__test_routes__") || id.endsWith(".__host") || id === "routes/admin" || id.startsWith("routes/admin/");
|
||||
return (
|
||||
id === "root" ||
|
||||
id.startsWith("routes/_") ||
|
||||
id.startsWith("__test_routes__") ||
|
||||
id.endsWith(".__host") ||
|
||||
id === "routes/admin" ||
|
||||
id.startsWith("routes/admin/")
|
||||
);
|
||||
}
|
||||
|
||||
function isAdminHostSitemapRoute(route: string) {
|
||||
@@ -131,8 +141,8 @@ async function getSitemapXml(request: Request, remixContext: EntryContext) {
|
||||
}
|
||||
}
|
||||
|
||||
i18nConfig.supportedLngs
|
||||
.filter((f) => f !== i18nConfig.fallbackLng)
|
||||
enabledLocales
|
||||
.filter((locale) => locale !== defaultLocale)
|
||||
.forEach((lng) => {
|
||||
sitemapEntries.forEach((entry) => {
|
||||
const newEntry = { ...entry };
|
||||
@@ -147,43 +157,42 @@ async function getSitemapXml(request: Request, remixContext: EntryContext) {
|
||||
|
||||
const knowledgeBases = await KnowledgeBaseServiceServer.getAll({
|
||||
enabled: true,
|
||||
publicOnly: true,
|
||||
request,
|
||||
});
|
||||
for (const kb of knowledgeBases) {
|
||||
// let languages: (string | undefined)[] = kb.languages ?? [kb.defaultLanguage];
|
||||
// languages.push(undefined);
|
||||
|
||||
// for (const lang of languages) {
|
||||
const kbUrl = KnowledgeBaseUtils.getKbUrl({ kb, params: {} });
|
||||
addSitemapEntry(sitemapEntries, {
|
||||
route: kbUrl,
|
||||
lastmod: kb.updatedAt ? kb.updatedAt.toISOString() : kb.createdAt?.toISOString(),
|
||||
});
|
||||
const allCategories = await KnowledgeBaseServiceServer.getCategories({
|
||||
kb,
|
||||
params: {},
|
||||
request,
|
||||
});
|
||||
for (const category of allCategories) {
|
||||
await withPublicKnowledgeBaseRlsContext(kb.slug, async () => {
|
||||
const kbUrl = KnowledgeBaseUtils.getKbUrl({ kb, params: {} });
|
||||
addSitemapEntry(sitemapEntries, {
|
||||
route: KnowledgeBaseUtils.getCategoryUrl({ kb, category, params: {} }),
|
||||
route: kbUrl,
|
||||
lastmod: kb.updatedAt ? kb.updatedAt.toISOString() : kb.createdAt?.toISOString(),
|
||||
});
|
||||
const allArticles = await KnowledgeBaseServiceServer.getArticles({
|
||||
const allCategories = await KnowledgeBaseServiceServer.getCategories({
|
||||
kb,
|
||||
language: kb.defaultLanguage,
|
||||
categoryId: category.id,
|
||||
query: undefined,
|
||||
params: {},
|
||||
request,
|
||||
});
|
||||
for (const article of allArticles.filter((f) => f.publishedAt)) {
|
||||
for (const category of allCategories) {
|
||||
addSitemapEntry(sitemapEntries, {
|
||||
route: KnowledgeBaseUtils.getArticleUrl({ kb, article, params: {} }),
|
||||
lastmod: article.updatedAt ? article.updatedAt.toISOString() : article.createdAt?.toISOString(),
|
||||
route: KnowledgeBaseUtils.getCategoryUrl({ kb, category, params: {} }),
|
||||
lastmod: kb.updatedAt ? kb.updatedAt.toISOString() : kb.createdAt?.toISOString(),
|
||||
});
|
||||
const allArticles = await KnowledgeBaseServiceServer.getArticles({
|
||||
kb,
|
||||
language: kb.defaultLanguage,
|
||||
categoryId: category.id,
|
||||
query: undefined,
|
||||
params: {},
|
||||
request,
|
||||
});
|
||||
for (const article of allArticles) {
|
||||
addSitemapEntry(sitemapEntries, {
|
||||
route: KnowledgeBaseUtils.getArticleUrl({ kb, article, params: {} }),
|
||||
lastmod: article.updatedAt ? article.updatedAt.toISOString() : article.createdAt?.toISOString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return `
|
||||
|
||||
Reference in new issue
Block a user