Thomas Kaul
2 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
12 additions and
5 deletions
-
apps/api/src/app/endpoints/sitemap/sitemap.service.ts
|
|
@ -1,3 +1,4 @@ |
|
|
|
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; |
|
|
|
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'; |
|
|
@ -6,9 +7,14 @@ import { Injectable } from '@nestjs/common'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class SitemapService { |
|
|
|
public constructor(private readonly i18nService: I18nService) {} |
|
|
|
public constructor( |
|
|
|
private readonly configurationService: ConfigurationService, |
|
|
|
private readonly i18nService: I18nService |
|
|
|
) {} |
|
|
|
|
|
|
|
public getPersonalFinanceTools({ currentDate }: { currentDate: string }) { |
|
|
|
const rootUrl = this.configurationService.get('ROOT_URL'); |
|
|
|
|
|
|
|
return personalFinanceTools |
|
|
|
.map(({ alias, key }) => { |
|
|
|
return SUPPORTED_LANGUAGE_CODES.map((languageCode) => { |
|
|
@ -29,12 +35,13 @@ export class SitemapService { |
|
|
|
|
|
|
|
return [ |
|
|
|
' <url>', |
|
|
|
` <loc>https://ghostfol.io/${languageCode}/${resourcesPath}/${personalFinanceToolsPath}/${openSourceAlternativeToPath}-${alias ?? key}</loc>`, |
|
|
|
` <loc>${rootUrl}/${languageCode}/${resourcesPath}/${personalFinanceToolsPath}/${openSourceAlternativeToPath}-${alias ?? key}</loc>`, |
|
|
|
` <lastmod>${currentDate}T00:00:00+00:00</lastmod>`, |
|
|
|
' </url>' |
|
|
|
].join('\n'); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.flat() |
|
|
|
.join('\n'); |
|
|
|
} |
|
|
|
} |
|
|
|