Skip to content

Commit

Permalink
fix: reading PUBLIC_SITE_TITLE in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Feb 12, 2024
1 parent bb18ff8 commit 1b402c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/components/MetaItem.astro
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const getDatas = async ({ collectionType, item, meta, collectionTypeMeta }) => {
)}
<ul class="mb-0">
{toDisplay.map(async (item, index) => {
console.log(item !== null && typeof item === "object");
if (item !== null && typeof item === "object") {
const value = await getDatas({
meta,
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/ui.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
function getTranslatedTitle(lang: string, key: string = "short") {
const SITE_TITLE: object = JSON.parse(
import.meta.env.PUBLIC_SITE_TITLE || process.env.SITE_TITLE,
(import.meta.env.PUBLIC_SITE_TITLE || process.env.SITE_TITLE).replaceAll(
"\\",
"",
),
);
return `${SITE_TITLE[lang][key] || SITE_TITLE[defaultLang][key] || "TBD"}`;
}
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export function capitalizeFirstLetter(string) {

export function getTranslatedTitle(lang: string, key: string = "short") {
const SITE_TITLE: object = JSON.parse(
import.meta.env.PUBLIC_SITE_TITLE || process.env.SITE_TITLE,
(import.meta.env.PUBLIC_SITE_TITLE || process.env.SITE_TITLE).replaceAll(
"\\",
"",
),
);
return `${SITE_TITLE[lang][key] || SITE_TITLE[defaultLang][key] || "TBD"}`;
}

0 comments on commit 1b402c6

Please sign in to comment.