Skip to content

Commit

Permalink
feat(seo): add metadataBase config on root layout
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Nov 3, 2023
1 parent a45101f commit 24fbdaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/app/blog/post/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useMDXComponent } from 'next-contentlayer/hooks'
import { allPosts, type Post } from 'contentlayer/generated'

import { slug } from '@/shared/lib/slug'
import { config } from 'global-config'
import {
Folder,
CalendarBlank,
Expand Down Expand Up @@ -41,9 +40,9 @@ export function generateMetadata({ params }: Props): Metadata {
tags: post.tags.split(',').map(tag => tag.trim()),
authors: 'Mateus Felipe Gonçalves <[email protected]>',
type: 'article',
url: `https://mateusf.com/blog/post/${params.slug}`,
url: `/blog/post/${params.slug}`,
images: {
url: `${config.webserver.host}/blog/post/${post.id}/thumbnail`,
url: `/blog/post/${post.id}/thumbnail`,
width: 1200,
height: 630
}
Expand All @@ -53,9 +52,9 @@ export function generateMetadata({ params }: Props): Metadata {
title: post.title,
description: post.description,
creator: 'Mateus Felipe Gonçalves <[email protected]>',
site: `${config.webserver.host}`,
site: '/',
images: {
url: `${config.webserver.host}/blog/post/${post.id}/thumbnail`,
url: `/blog/post/${post.id}/thumbnail`,
width: 1200,
height: 630
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import '@/styles/main.css'

export const metadata: Metadata = {
...config.metadata,
metadataBase: new URL(config.webserver.host),
title: {
default: config.metadata.title,
template: `%s | ${config.metadata.title}`
Expand Down Expand Up @@ -38,7 +39,7 @@ export const metadata: Metadata = {
openGraph: {
...config.metadata,
type: 'website',
url: config.webserver.host,
url: '/',
emails: [
'[email protected]',
'[email protected]',
Expand Down

0 comments on commit 24fbdaa

Please sign in to comment.