Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/dynamically compose public routes in sitemap (#5035)

csehatt741bd43ea9b6cbb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d6f10399f4..08a7ad7722 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Introduced fuzzy search for the quick links of the assistant
- Improved the search results of the assistant to only display categories with content
+- Enhanced the sitemap to dynamically compose public routes
- Renamed `Account` to `account` in the `Order` database schema
- Improved the language localization for German (`de`)
diff --git a/apps/api/src/app/endpoints/sitemap/sitemap.controller.ts b/apps/api/src/app/endpoints/sitemap/sitemap.controller.ts
index 4d6dfb5ea2..f10f0bfd87 100644
--- a/apps/api/src/app/endpoints/sitemap/sitemap.controller.ts
+++ b/apps/api/src/app/endpoints/sitemap/sitemap.controller.ts
@@ -37,12 +37,14 @@ export class SitemapController {
response.setHeader('content-type', 'application/xml');
response.send(
interpolate(this.sitemapXml, {
- currentDate,
personalFinanceTools: this.configurationService.get(
'ENABLE_FEATURE_SUBSCRIPTION'
)
? this.sitemapService.getPersonalFinanceTools({ currentDate })
- : ''
+ : '',
+ publicRoutes: this.sitemapService.getPublicRoutes({
+ currentDate
+ })
})
);
}
diff --git a/apps/api/src/app/endpoints/sitemap/sitemap.service.ts b/apps/api/src/app/endpoints/sitemap/sitemap.service.ts
index ea8a7c8c29..d18fe884a6 100644
--- a/apps/api/src/app/endpoints/sitemap/sitemap.service.ts
+++ b/apps/api/src/app/endpoints/sitemap/sitemap.service.ts
@@ -2,11 +2,16 @@ import { ConfigurationService } from '@ghostfolio/api/services/configuration/con
import { I18nService } from '@ghostfolio/api/services/i18n/i18n.service';
import { SUPPORTED_LANGUAGE_CODES } from '@ghostfolio/common/config';
import { personalFinanceTools } from '@ghostfolio/common/personal-finance-tools';
+import { PublicRoute } from '@ghostfolio/common/routes/interfaces/public-route.interface';
+import { publicRoutes } from '@ghostfolio/common/routes/routes';
import { Injectable } from '@nestjs/common';
@Injectable()
export class SitemapService {
+ private static readonly TRANSLATION_TAGGED_MESSAGE_REGEX =
+ /:.*@@(?<id>[a-zA-Z0-9.]+):(?<message>.+)/;
+
public constructor(
private readonly configurationService: ConfigurationService,
private readonly i18nService: I18nService
@@ -15,33 +20,97 @@ export class SitemapService {
public getPersonalFinanceTools({ currentDate }: { currentDate: string }) {
const rootUrl = this.configurationService.get('ROOT_URL');
- return personalFinanceTools
- .map(({ alias, key }) => {
- return SUPPORTED_LANGUAGE_CODES.map((languageCode) => {
- const resourcesPath = this.i18nService.getTranslation({
- languageCode,
- id: 'routes.resources'
- });
-
- const personalFinanceToolsPath = this.i18nService.getTranslation({
- languageCode,
- id: 'routes.resources.personalFinanceTools'
- });
-
- const openSourceAlternativeToPath = this.i18nService.getTranslation({
- languageCode,
- id: 'routes.resources.personalFinanceTools.openSourceAlternativeTo'
- });
-
- return [
- ' <url>',
- ` <loc>${rootUrl}/${languageCode}/${resourcesPath}/${personalFinanceToolsPath}/${openSourceAlternativeToPath}-${alias ?? key}</loc>`,
- ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,
- ' </url>'
- ].join('\n');
- });
- })
- .flat()
- .join('\n');
+ return SUPPORTED_LANGUAGE_CODES.flatMap((languageCode) => {
+ return personalFinanceTools.map(({ alias, key }) => {
+ const route =
+ publicRoutes.resources.subRoutes.personalFinanceTools.subRoutes
+ .product;
+ const params = {
+ currentDate,
+ languageCode,
+ rootUrl,
+ urlPostfix: alias ?? key
+ };
+
+ return this.createRouteSitemapUrl({ ...params, route });
+ });
+ }).join('\n');
+ }
+
+ public getPublicRoutes({ currentDate }: { currentDate: string }) {
+ const rootUrl = this.configurationService.get('ROOT_URL');
+
+ return SUPPORTED_LANGUAGE_CODES.flatMap((languageCode) => {
+ const params = {
+ currentDate,
+ languageCode,
+ rootUrl
+ };
+
+ return [
+ this.createRouteSitemapUrl(params),
+ ...this.createSitemapUrls(params, publicRoutes)
+ ];
+ }).join('\n');
+ }
+
+ private createRouteSitemapUrl({
+ currentDate,
+ languageCode,
+ rootUrl,
+ route,
+ urlPostfix
+ }: {
+ currentDate: string;
+ languageCode: string;
+ rootUrl: string;
+ route?: PublicRoute;
+ urlPostfix?: string;
+ }): string {
+ const segments =
+ route?.routerLink.map((link) => {
+ const match = link.match(
+ SitemapService.TRANSLATION_TAGGED_MESSAGE_REGEX
+ );
+
+ const segment = match
+ ? (this.i18nService.getTranslation({
+ languageCode,
+ id: match.groups.id
+ }) ?? match.groups.message)
+ : link;
+
+ return segment.replace(/^\/+|\/+$/, '');
+ }) ?? [];
+
+ const location =
+ [rootUrl, languageCode, ...segments].join('/') +
+ (urlPostfix ? `-${urlPostfix}` : '');
+
+ return [
+ ' <url>',
+ ` <loc>${location}</loc>`,
+ ` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`,
+ ' </url>'
+ ].join('\n');
+ }
+
+ private createSitemapUrls(
+ params: { currentDate: string; languageCode: string; rootUrl: string },
+ routes: Record<string, PublicRoute>
+ ): string[] {
+ return Object.values(routes).flatMap((route) => {
+ if (route.excludeFromSitemap) {
+ return [];
+ }
+
+ const urls = [this.createRouteSitemapUrl({ ...params, route })];
+
+ if (route.subRoutes) {
+ urls.push(...this.createSitemapUrls(params, route.subRoutes));
+ }
+
+ return urls;
+ });
}
}
diff --git a/apps/api/src/assets/sitemap.xml b/apps/api/src/assets/sitemap.xml
index f1ec2d95d1..fb2a5403ec 100644
--- a/apps/api/src/assets/sitemap.xml
+++ b/apps/api/src/assets/sitemap.xml
@@ -4,585 +4,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
- <url>
- <loc>https://ghostfol.io/ca</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/blog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/blog/2021/07/hallo-ghostfolio</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/blog/2023/01/ghostfolio-auf-sackgeld-vorgestellt</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/features</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/haeufig-gestellte-fragen</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/maerkte</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/open</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/preise</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/registrierung</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ressourcen</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ressourcen/lexikon</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ressourcen/maerkte</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ressourcen/personal-finance-tools</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ressourcen/ratgeber</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ueber-uns</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ueber-uns/changelog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ueber-uns/datenschutzbestimmungen</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ueber-uns/lizenz</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/de/ueber-uns/oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/development/storybook</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/about</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/about/changelog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/about/license</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/about/oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2021/07/hello-ghostfolio</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2022/01/ghostfolio-first-months-in-open-source</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2022/07/ghostfolio-meets-internet-identity</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2022/07/how-do-i-get-my-finances-in-order</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2022/08/500-stars-on-github</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2022/10/hacktoberfest-2022</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2022/11/black-friday-2022</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2022/12/the-importance-of-tracking-your-personal-finances</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/02/ghostfolio-meets-umbrel</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/03/ghostfolio-reaches-1000-stars-on-github</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/05/unlock-your-financial-potential-with-ghostfolio</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/07/exploring-the-path-to-fire</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/08/ghostfolio-joins-oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/09/ghostfolio-2</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/09/hacktoberfest-2023</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/11/black-week-2023</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2023/11/hacktoberfest-2023-debriefing</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2024/09/hacktoberfest-2024</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/blog/2024/11/black-weeks-2024</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/faq</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/saas</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/self-hosting</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/features</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/markets</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/open</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/pricing</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/register</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/resources</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/resources/glossary</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/resources/guides</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/resources/markets</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/en/resources/personal-finance-tools</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/funcionalidades</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/mercados</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/open</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/precios</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/preguntas-mas-frecuentes</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/recursos</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/recursos/personal-finance-tools</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/registro</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/sobre</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/sobre/changelog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/sobre/licencia</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/sobre/oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/es/sobre/politica-de-privacidad</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/a-propos</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/a-propos/journal-des-modifications</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/a-propos/licence</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/a-propos/oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/a-propos/politique-de-confidentialite</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/enregistrement</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/fonctionnalites</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/foire-aux-questions</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/marches</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/open</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/prix</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/ressources</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/fr/ressources/personal-finance-tools</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/domande-piu-frequenti</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/funzionalita</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/informazioni-su</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/informazioni-su/registro-delle-modifiche</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/informazioni-su/informativa-sulla-privacy</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/informazioni-su/licenza</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/informazioni-su/oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/iscrizione</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/mercati</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/open</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/prezzi</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/risorse</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/it/risorse/personal-finance-tools</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/bronnen</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/bronnen/personal-finance-tools</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/functionaliteiten</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/markten</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/open</loc>
- <changefreq>daily</changefreq>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/over</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/over/licentie</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/over/oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/over/privacybeleid</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/over/wijzigingslogboek</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/prijzen</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/registratie</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/nl/veelgestelde-vragen</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl/blog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl/cennik</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl/funkcje</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl/o-ghostfolio</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl/open</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl/rynki</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pl/zarejestruj</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/blog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/funcionalidades</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/mercados</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/open</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/perguntas-mais-frequentes</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/precos</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/recursos</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/recursos/personal-finance-tools</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/registo</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/sobre</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/sobre/changelog</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/sobre/licenca</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/sobre/oss-friends</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/pt/sobre/politica-de-privacidade</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/tr</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/uk</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
- <url>
- <loc>https://ghostfol.io/zh</loc>
- <lastmod>${currentDate}T00:00:00+00:00</lastmod>
- </url>
+ ${publicRoutes}
${personalFinanceTools}
</urlset>
diff --git a/libs/common/src/lib/routes/interfaces/interfaces.ts b/libs/common/src/lib/routes/interfaces/internal-route.interface.ts
similarity index 69%
rename from libs/common/src/lib/routes/interfaces/interfaces.ts
rename to libs/common/src/lib/routes/interfaces/internal-route.interface.ts
index 5acbb23504..02f2059792 100644
--- a/libs/common/src/lib/routes/interfaces/interfaces.ts
+++ b/libs/common/src/lib/routes/interfaces/internal-route.interface.ts
@@ -1,9 +1,9 @@
import { User } from '@ghostfolio/common/interfaces';
-export interface IRoute {
+export interface InternalRoute {
excludeFromAssistant?: boolean | ((aUser: User) => boolean);
path: string;
routerLink: string[];
- subRoutes?: Record<string, IRoute>;
+ subRoutes?: Record<string, InternalRoute>;
title: string;
}
diff --git a/libs/common/src/lib/routes/interfaces/public-route.interface.ts b/libs/common/src/lib/routes/interfaces/public-route.interface.ts
new file mode 100644
index 0000000000..ad133200d9
--- /dev/null
+++ b/libs/common/src/lib/routes/interfaces/public-route.interface.ts
@@ -0,0 +1,7 @@
+export interface PublicRoute {
+ excludeFromSitemap?: boolean;
+ path: string;
+ routerLink: string[];
+ subRoutes?: Record<string, PublicRoute>;
+ title?: string;
+}
diff --git a/libs/common/src/lib/routes/routes.ts b/libs/common/src/lib/routes/routes.ts
index ee58d12a73..9c6461a754 100644
--- a/libs/common/src/lib/routes/routes.ts
+++ b/libs/common/src/lib/routes/routes.ts
@@ -1,11 +1,21 @@
import { User } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
-import '@angular/localize/init';
+import { InternalRoute } from './interfaces/internal-route.interface';
+import { PublicRoute } from './interfaces/public-route.interface';
-import { IRoute } from './interfaces/interfaces';
+if (typeof window !== 'undefined') {
+ import('@angular/localize/init');
+} else {
+ (global as any).$localize = (
+ messageParts: TemplateStringsArray,
+ ...expressions: any[]
+ ) => {
+ return String.raw({ raw: messageParts }, ...expressions);
+ };
+}
-export const internalRoutes: Record<string, IRoute> = {
+export const internalRoutes: Record<string, InternalRoute> = {
account: {
path: 'account',
routerLink: ['/account'],
@@ -156,7 +166,7 @@ export const internalRoutes: Record<string, IRoute> = {
}
};
-export const publicRoutes = {
+export const publicRoutes: Record<string, PublicRoute> = {
about: {
path: $localize`:kebab-case@@routes.about:about`,
routerLink: ['/' + $localize`:kebab-case@@routes.about:about`],
@@ -300,9 +310,14 @@ export const publicRoutes = {
$localize`:kebab-case@@routes.resources.personalFinanceTools:personal-finance-tools`
],
subRoutes: {
- excludeFromSitemap: true,
product: {
+ excludeFromSitemap: true,
path: $localize`:kebab-case@@routes.resources.personalFinanceTools.openSourceAlternativeTo:open-source-alternative-to`,
+ routerLink: [
+ '/' + $localize`:kebab-case@@routes.resources:resources`,
+ $localize`:kebab-case@@routes.resources.personalFinanceTools:personal-finance-tools`,
+ $localize`:kebab-case@@routes.resources.personalFinanceTools.openSourceAlternativeTo:open-source-alternative-to`
+ ],
title: $localize`Open Source Alternative to`
}
},
diff --git a/libs/ui/src/lib/assistant/assistant.component.ts b/libs/ui/src/lib/assistant/assistant.component.ts
index 75e770ca7d..de1733cf2c 100644
--- a/libs/ui/src/lib/assistant/assistant.component.ts
+++ b/libs/ui/src/lib/assistant/assistant.component.ts
@@ -3,7 +3,7 @@ import { AdminService } from '@ghostfolio/client/services/admin.service';
import { DataService } from '@ghostfolio/client/services/data.service';
import { getAssetProfileIdentifier } from '@ghostfolio/common/helper';
import { Filter, PortfolioPosition, User } from '@ghostfolio/common/interfaces';
-import { IRoute } from '@ghostfolio/common/routes/interfaces/interfaces';
+import { InternalRoute } from '@ghostfolio/common/routes/interfaces/internal-route.interface';
import { internalRoutes } from '@ghostfolio/common/routes/routes';
import { DateRange } from '@ghostfolio/common/types';
import { GfEntityLogoComponent } from '@ghostfolio/ui/entity-logo';
@@ -641,7 +641,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
acc.push(...Object.values(route.subRoutes));
}
return acc;
- }, [] as IRoute[]);
+ }, [] as InternalRoute[]);
const fuse = new Fuse(allRoutes, {
keys: ['title'],