-
-
Notifications
You must be signed in to change notification settings - Fork 15
fix(seo): fix canonical URLs, hreflang, soft-404s, and noindex for private pages #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -167,7 +167,7 @@ const CourseDetailContainer = ({ | |||||||||||||||||
| courseCode: `${course.department} ${course.course}-${course.class}`, | ||||||||||||||||||
| educationalLevel: "University", | ||||||||||||||||||
| inLanguage: "zh-TW", | ||||||||||||||||||
| url: `https://nthumods.com/zh/courses/${course.raw_id}`, | ||||||||||||||||||
| url: `https://nthumods.com/${lang}/courses/${course.raw_id}`, | ||||||||||||||||||
| offers: { | ||||||||||||||||||
| "@type": "Offer", | ||||||||||||||||||
| price: "0", | ||||||||||||||||||
|
|
@@ -227,18 +227,24 @@ const CourseDetailContainer = ({ | |||||||||||||||||
| // Handle error state | ||||||||||||||||||
| if (error || !course) { | ||||||||||||||||||
| return ( | ||||||||||||||||||
| <div className="py-6 px-4"> | ||||||||||||||||||
| <div className="flex flex-col gap-2 border-l border-neutral-500 pl-4 pr-6"> | ||||||||||||||||||
| <h1 className="text-2xl font-bold">404</h1> | ||||||||||||||||||
| <p className="text-xl">找不到課程</p> | ||||||||||||||||||
| <> | ||||||||||||||||||
| <Helmet> | ||||||||||||||||||
| <meta name="robots" content="noindex, nofollow" /> | ||||||||||||||||||
| <meta name="googlebot" content="noindex, nofollow" /> | ||||||||||||||||||
|
Comment on lines
+232
to
+233
|
||||||||||||||||||
| <meta name="robots" content="noindex, nofollow" /> | |
| <meta name="googlebot" content="noindex, nofollow" /> | |
| <meta name="robots" content="noindex, follow" /> | |
| <meta name="googlebot" content="noindex, follow" /> | |
| <link | |
| rel="canonical" | |
| href={`https://nthumods.com/${lang}/courses`} | |
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSON-LD
Courseobject still hardcodesinLanguage: "zh-TW"even when rendering an/en/...page, whileurlis now language-specific. This produces inconsistent structured data for English pages. Consider derivinginLanguage(and possibly the primaryname) from thelangprop so the schema matches the page language.