Merged in chore/remove-unused-env-vars (pull request #2463)
chore: Remove unused env vars and feature toggles * Remove unused env vars and feature toggles Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -7,7 +7,6 @@ import { getDescription } from "./description"
|
||||
import { getImage } from "./image"
|
||||
import { getTitle } from "./title"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { Metadata } from "next"
|
||||
import type { AlternateURLs } from "next/dist/lib/metadata/types/alternative-urls-types"
|
||||
|
||||
@@ -20,12 +19,10 @@ import type {
|
||||
|
||||
export async function generateMetadata({
|
||||
searchParams,
|
||||
params,
|
||||
}: PageArgs<
|
||||
LangParams & ContentTypeParams & UIDParams,
|
||||
{ subpage?: string; filterFromUrl?: string }
|
||||
>) {
|
||||
const { lang } = await params
|
||||
const { subpage, filterFromUrl, ...otherSearchParams } = await searchParams
|
||||
// If there are other (real) search params, we don't want to index the page as this will
|
||||
// cause duplicate content issues.
|
||||
@@ -41,8 +38,8 @@ export async function generateMetadata({
|
||||
if (!rawMetadata) {
|
||||
return {
|
||||
robots: {
|
||||
index: env.isLangLive(lang),
|
||||
follow: env.isLangLive(lang),
|
||||
index: true,
|
||||
follow: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -57,15 +54,14 @@ export async function generateMetadata({
|
||||
...metadata,
|
||||
robots: {
|
||||
...(metadata.robots ?? {}),
|
||||
index: isIndexable(metadata.robots?.index, lang, alternates),
|
||||
follow: isIndexable(metadata.robots?.follow, lang, alternates),
|
||||
index: isIndexable(metadata.robots?.index, alternates),
|
||||
follow: isIndexable(metadata.robots?.follow, alternates),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function isIndexable(
|
||||
pageIndexableFromSettings: boolean | null | undefined,
|
||||
lang: Lang,
|
||||
alternates: AlternateURLs | null
|
||||
) {
|
||||
// This is a special case for whitelisting the scandic friends pages, this can be removed when all pages are live
|
||||
@@ -76,7 +72,7 @@ function isIndexable(
|
||||
}
|
||||
|
||||
// If we are live we want to index the page, but if the page has been marked as noindex in contentstack we don't
|
||||
return (pageIndexableFromSettings ?? true) && env.isLangLive(lang)
|
||||
return pageIndexableFromSettings ?? true
|
||||
}
|
||||
|
||||
function getUrl(alternates: AlternateURLs | null): string | null {
|
||||
|
||||
Reference in New Issue
Block a user