Skip to content

Commit

Permalink
DIGG-483: Adding lang check on forgotten pages
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaMunterud committed Dec 6, 2024
1 parent b0c7555 commit 78e1409
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
7 changes: 5 additions & 2 deletions pages/concepts/[concept]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export default function Concept() {
);
}

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
export const getServerSideProps: GetServerSideProps = async ({
params,
locale,
}) => {
const env = SettingsUtil.create();
const { concept } = params || {};

Expand All @@ -56,7 +59,7 @@ export const getServerSideProps: GetServerSideProps = async ({ params }) => {
if (entry) {
return {
redirect: {
destination: `/concepts/${entry
destination: `/${locale}/concepts/${entry
.getContext()
.getId()}_${entry.getId()}`,
permanent: true, // This creates a 301 redirect
Expand Down
7 changes: 5 additions & 2 deletions pages/specifications/[spec]/[param].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export default function Specification() {
return null;
}

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
export const getServerSideProps: GetServerSideProps = async ({
params,
locale,
}) => {
const env = SettingsUtil.create();
const { spec, param } = params || {};
const curi = `${spec}/${param}`;
Expand All @@ -27,7 +30,7 @@ export const getServerSideProps: GetServerSideProps = async ({ params }) => {
if (entry) {
return {
redirect: {
destination: `/specifications/${entry
destination: `/${locale}/specifications/${entry
.getContext()
.getId()}_${entry.getId()}`,
permanent: true, // This creates a 301 redirect
Expand Down
7 changes: 5 additions & 2 deletions pages/specifications/[spec]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export default function Specification() {
}
}

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
export const getServerSideProps: GetServerSideProps = async ({
params,
locale,
}) => {
const env = SettingsUtil.create();
const { spec } = params || {};

Expand All @@ -54,7 +57,7 @@ export const getServerSideProps: GetServerSideProps = async ({ params }) => {
if (entry) {
return {
redirect: {
destination: `/specifications/${entry
destination: `/${locale}/specifications/${entry
.getContext()
.getId()}_${entry.getId()}`,
permanent: true, // This creates a 301 redirect
Expand Down
7 changes: 5 additions & 2 deletions pages/terminology/[term]/[param].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export default function Terminology() {
return null;
}

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
export const getServerSideProps: GetServerSideProps = async ({
params,
locale,
}) => {
const env = SettingsUtil.create();
const { terminology, param } = params || {};
const curi = `${terminology}/${param}`;
Expand All @@ -27,7 +30,7 @@ export const getServerSideProps: GetServerSideProps = async ({ params }) => {
if (entry) {
return {
redirect: {
destination: `/terminology/${entry
destination: `/${locale}/terminology/${entry
.getContext()
.getId()}_${entry.getId()}`,
permanent: true, // This creates a 301 redirect
Expand Down
7 changes: 5 additions & 2 deletions pages/terminology/[term]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export default function Terminology() {
);
}

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
export const getServerSideProps: GetServerSideProps = async ({
params,
locale,
}) => {
const env = SettingsUtil.create();
const { term } = params || {};

Expand All @@ -52,7 +55,7 @@ export const getServerSideProps: GetServerSideProps = async ({ params }) => {
if (entry) {
return {
redirect: {
destination: `/terminology/${entry
destination: `/${locale}/terminology/${entry
.getContext()
.getId()}_${entry.getId()}`,
permanent: true, // This creates a 301 redirect
Expand Down

0 comments on commit 78e1409

Please sign in to comment.