Skip to content

Commit

Permalink
sitemap update
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil-aexol committed Nov 9, 2023
1 parent 85b1422 commit be00088
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from "./basicAnalyzer.js";
export * from "./prepareHTML.js";
export * from "./advancedAnalyzer.js";
export * from "./checkFile.js";
export * from "./sections/index.js";
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
CombineTagsWithReason,
CombinedPatterns,
advancedTagsName,
generateMainSection,
generateMetaTagsSection,
generateMissingKeywordsSection,
} from "../../index.js";
import { generateMainSection } from "./sections/generateMainSection.js";
import { generateMetaTagsSection } from "./sections/generateMetaTagsSection.js";
import { generateMissingKeywordsSection } from "./sections/generateMissingKeywordsSection.js";

type KeywordsTagsProps = Record<string, string[]>;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./generateMainSection.js";
export * from "./generateMetaTagsSection.js";
export * from "./generateMissingKeywordsSection.js";
33 changes: 19 additions & 14 deletions packages/landing-friend-core/src/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,26 @@ const localeSeoGenerator = (
const links = page[key].links;
const priority = page[key].priority;

return `
<url>
<loc>${key}</loc>${links
.map(({ locale, link }) => {
const replaced = link.replace(`/${locale}`, "");
return defaultLocale === locale
? `
<xhtml:link rel="alternate" hreflang="${locale}" href="${replaced}"/>`
: `
<xhtml:link rel="alternate" hreflang="${locale}" href="${link}"/>`;
return links
.map(({ locale: mainLocale, link: linkToKey }) => {
const replaced = linkToKey.replace(`/${mainLocale}`, "");
return `
<url>
<loc>${defaultLocale === mainLocale ? replaced : linkToKey}</loc>${links
.map(({ locale, link }) => {
const replaced = link.replace(`/${locale}`, "");
return defaultLocale === locale
? `
<xhtml:link rel="alternate" hreflang="${locale}" href="${replaced}"/>`
: `
<xhtml:link rel="alternate" hreflang="${locale}" href="${link}"/>`;
})
.join("")}
<lastmod>${new Date().toISOString()}</lastmod>
<priority>${(priority + 0.1).toFixed(1)}</priority>
</url>`;
})
.join("")}
<lastmod>${new Date().toISOString()}</lastmod>
<priority>${(priority + 0.1).toFixed(1)}</priority>
</url>`;
.join("");
});
return data.join("").concat(classicSeoFragmentGenerator(classicWithoutLocales));
};
Expand Down

0 comments on commit be00088

Please sign in to comment.