Skip to content

Commit

Permalink
Merge pull request #250 from mokletdev/development
Browse files Browse the repository at this point in the history
Improve SEO
  • Loading branch information
justpiple authored Jul 11, 2024
2 parents 8ea1d97 + 3fd6e86 commit f26dd8a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/app/(main)/berita/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ export async function generateMetadata({
title: post.title,
description: post.description,
authors: { name: post.user.name },
creator: post.user.name,
openGraph: {
url: `https://moklet.org/berita/${post.slug}`,
url: `${process.env.URL ?? "https://www.moklet.org/berita/"}${post.slug}`,
images: post.thumbnail,
title: post.title,
description: post.description,
type: "article",
publishedTime: new Date(post.published_at!).toISOString(),
modifiedTime: new Date(post.updated_at).toISOString(),
authors: post.user.name,
},
robots: "max-image-preview:large",
keywords:
Expand Down
3 changes: 3 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const metadata: Metadata = {
authors: { name: "MokletDev", url: "https://dev.moklet.org" },
creator: "MokletDev Team",
publisher: "SMK Telkom Malang",
openGraph: {
images: "https://www.moklet.org/horizontal.svg",
},
robots: robots,
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export default function robots(): MetadataRoute.Robots {
allow: "/",
disallow: ["/admin/"],
},
sitemap: `${process.env.NEXTAUTH_URL}/sitemap.xml`,
sitemap: `${process.env.URL ?? "https://www.moklet.org"}/sitemap.xml`,
};
}
10 changes: 5 additions & 5 deletions src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
"/tentang",
"/kontributor",
].map((route) => ({
url: `${process.env.NEXTAUTH_URL}/${route}`,
url: `${process.env.URL ?? "https://moklet.org"}/${route}`,
lastModified: new Date().toISOString(),
changeFrequency: "yearly" as
changeFrequency: "monthly" as
| "yearly"
| "monthly"
| "never"
Expand All @@ -26,8 +26,8 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
}));

const postsRoutes = posts.map((post) => ({
url: `${process.env.NEXTAUTH_URL}/blog/${post.slug}`,
lastModified: new Date().toISOString(),
url: `${process.env.URL ?? "https://www.moklet.org"}/blog/${post.slug}`,
lastModified: new Date(post.updated_at).toISOString(),
changeFrequency: "yearly" as
| "yearly"
| "monthly"
Expand All @@ -40,7 +40,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {

return [
{
url: `${process.env.NEXTAUTH_URL}/`,
url: `${process.env.URL ?? "https://www.moklet.org"}/`,
lastModified: new Date().toISOString(),
priority: 1,
changeFrequency: "never",
Expand Down

0 comments on commit f26dd8a

Please sign in to comment.