Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cute-sheep-find.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": patch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new feature

Suggested change
"nextjs-website": patch
"nextjs-website": minor

---

Implement redirect on product overview page and tutorial list page if the tutorial has redirectPath set
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const OverviewPage = async (props: ProductParams) => {
...tutorial,
image: tutorial.image,
link: {
url: tutorial.path,
url: tutorial.redirectPath || tutorial.path,
text: 'shared.readTutorial',
},
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const TutorialsPage = async (props: ProductParams) => {
},
href: {
label: 'shared.readTutorial',
link: tutorial.path,
link: tutorial.redirectPath || tutorial.path,
translate: true,
},
img: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const TutorialsSectionPreviewCardsLayout = ({
text: tutorial.description || '',
icon: tutorial.icon?.url,
useSrc: tutorial.icon !== undefined,
href: tutorial.path,
href: tutorial.redirectPath || tutorial.path,
}))}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function makeTutorialsProps(
seo: attributes.seo,
tags: attributes.tags.data?.map((tag) => tag.attributes) || [],
updatedAt: attributes.updatedAt,
redirectPath: attributes.redirectPath,
} satisfies TutorialProps;
} catch (error) {
console.error(
Expand Down
1 change: 1 addition & 0 deletions apps/nextjs-website/src/lib/strapi/types/tutorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type StrapiBaseTutorial = {
readonly data?: StrapiMedia;
};
readonly description?: string;
readonly redirectPath?: string;
};
};

Expand Down
1 change: 1 addition & 0 deletions apps/nextjs-website/src/lib/types/tutorialData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export type Tutorial = {
readonly seo?: SEO;
readonly tags?: readonly Tag[];
readonly updatedAt?: string;
readonly redirectPath?: string;
} & Path;
Loading