Skip to content

Commit

Permalink
fix: 404 page if manga details aren't found
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeydin21 committed Jun 27, 2024
1 parent 487038a commit be81e28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions pages/manga/info/[mangaId].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export const getServerSideProps = async (context) => {

const mangaData = await getMangaDetails(mangaId);

const title = mangaData?.title?.english || mangaData?.title?.romaji;
if (!title) {
return {
notFound: true,
};
}

return {
props: {
mangaData,
Expand All @@ -18,15 +25,17 @@ export const getServerSideProps = async (context) => {
};

function MangaDetailsPage({ mangaData }) {
const title = mangaData?.title?.english || mangaData?.title?.romaji;

return (
<>
<Head>
<title>{(mangaData?.title.english || mangaData?.title.romaji) + " - Munchyroll"}</title>
<title>{title + " - Munchyroll"}</title>
<meta name="description" content={mangaData?.description} />
<meta name="keywords" content={mangaData?.genres} />
<meta
property="og:title"
content={"Read " + (mangaData?.title.english || mangaData?.title.romaji) + " - Munchyroll "}
content={"Read " + title + " - Munchyroll "}
/>
<meta property="og:description" content={mangaData?.description} />
<meta property="og:image" content={mangaData?.image} />
Expand Down
2 changes: 1 addition & 1 deletion pages/manga/search/[searchId].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function SearchPage({ mangaSearchData }) {
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
</Head>
<MainLayout useHead={false} type={"anime"}>
<MainLayout useHead={false} type={"manga"}>

{mangaSearchData && (
<>
Expand Down

1 comment on commit be81e28

@vercel
Copy link

@vercel vercel bot commented on be81e28 Jun 27, 2024

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

munchyroll – ./

munchyroll-git-master-jeydin.vercel.app
munchyroll.vercel.app
munchyroll-jeydin.vercel.app
anime.j21.dev

Please sign in to comment.