Skip to content

Commit

Permalink
🐛 Fix: Add canonical URL
Browse files Browse the repository at this point in the history
  • Loading branch information
MarianoGarciaGz committed Jan 13, 2025
1 parent 68a126d commit 46174af
Show file tree
Hide file tree
Showing 2 changed files with 229 additions and 225 deletions.
298 changes: 151 additions & 147 deletions src/components/atoms/Head/Head.astro
Original file line number Diff line number Diff line change
@@ -1,169 +1,173 @@
---
import settings from '@src/config/settings.json'
const { postTitle, postDescription, postImage, postKeywords, postAuthor } = Astro.props
const { postTitle, postDescription, postImage, postKeywords, postAuthor } =
Astro.props
const { pageData } = Astro.props
const info = settings.info
const pageTitle =
postTitle ||
(pageData?.title
? `${pageData.title} - ${info.name}`
: `${info.name} - ${info.activity}`)
postTitle ||
(pageData?.title
? `${pageData.title} - ${info.name}`
: `${info.name} - ${info.activity}`)
const description = postDescription || pageData?.description || info.description
const url = pageData?.url || info.url
const url = pageData?.url || `${info.url}${Astro.url.pathname}`
const image = postImage || pageData?.image || info.defaultImage
const keywords = pageData?.keywords || info.defaultKeywords
const author = pageData?.author || info.author
const twitterHandle = pageData?.twitterHandle || info.twitterHandle
---

<head>
<meta charset='UTF-8' />
<meta
name='viewport'
content='width=device-width, initial-scale=1.0'
/>
<meta
http-equiv='X-UA-Compatible'
content='IE=edge'
/>
<meta
name='robots'
content='index, follow'
/>
<meta
name='language'
content='es'
/>
<meta charset='UTF-8' />
<meta
name='viewport'
content='width=device-width, initial-scale=1.0'
/>
<meta
http-equiv='X-UA-Compatible'
content='IE=edge'
/>
<meta
name='robots'
content='index, follow'
/>
<meta
name='language'
content='es'
/>
<link
rel='canonical'
href={url}
/>
<title>{pageTitle}</title>

<title>{pageTitle}</title>
<meta
name='description'
content={description}
/>
{
keywords && (
<meta
name='keywords'
content={keywords.join(', ')}
/>
)
}
{
author && (
<meta
name='author'
content={author}
/>
)
}

<meta
name='description'
content={description}
/>
{
keywords && (
<meta
name='keywords'
content={keywords.join(', ')}
/>
)
}
{
author && (
<meta
name='author'
content={author}
/>
)
}
<!-- Open Graph -->
<meta
property='og:site_name'
content={info.name}
/>
<meta
property='og:locale'
content='es_ES'
/>
<meta
property='og:title'
content={pageTitle}
/>
<meta
property='og:description'
content={description}
/>
<meta
property='og:url'
content={url}
/>
<meta
property='og:image'
content={`${info.url}${image}`}
/>
<meta
property='og:image:alt'
content={pageTitle}
/>
<meta
property='og:type'
content='website'
/>
<meta
property='og:site_name'
content={info.name}
/>

<!-- Open Graph -->
<meta
property='og:site_name'
content={info.name}
/>
<meta
property='og:locale'
content='es_ES'
/>
<meta
property='og:title'
content={pageTitle}
/>
<meta
property='og:description'
content={description}
/>
<meta
property='og:url'
content={info.url}
/>
<meta
property='og:image'
content={`${info.url}${image}`}
/>
<meta
property='og:image:alt'
content={pageTitle}
/>
<meta
property='og:type'
content='website'
/>
<meta
property='og:site_name'
content={info.name}
/>
<!-- Twitter Card -->
<meta
name='twitter:card'
content='summary_large_image'
/>
{
twitterHandle && (
<meta
name='twitter:site'
content={twitterHandle}
/>
)
}
<meta
name='twitter:title'
content={pageTitle}
/>
<meta
name='twitter:description'
content={description}
/>
<meta
name='twitter:image'
content={`${info.url}${image}`}
/>

<!-- Twitter Card -->
<meta
name='twitter:card'
content='summary_large_image'
/>
{
twitterHandle && (
<meta
name='twitter:site'
content={twitterHandle}
/>
)
}
<meta
name='twitter:title'
content={pageTitle}
/>
<meta
name='twitter:description'
content={description}
/>
<meta
name='twitter:image'
content={`${info.url}${image}`}
/>
<!-- Favicons -->
<link
rel='apple-touch-icon'
sizes='180x180'
href='/apple-touch-icon.png'
/>
<link
rel='icon'
type='image/png'
sizes='32x32'
href='/favicon-32x32.png'
/>
<link
rel='icon'
type='image/png'
sizes='16x16'
href='/favicon-16x16.png'
/>
<link
rel='manifest'
href='/site.webmanifest'
/>
<link
rel='mask-icon'
href='/safari-pinned-tab.svg'
color='#5bbad5'
/>
<meta
name='msapplication-TileColor'
content='#00a300'
/>
<meta
name='theme-color'
content='#ffffff'
/>

<!-- Favicons -->
<link
rel='apple-touch-icon'
sizes='180x180'
href='/apple-touch-icon.png'
/>
<link
rel='icon'
type='image/png'
sizes='32x32'
href='/favicon-32x32.png'
/>
<link
rel='icon'
type='image/png'
sizes='16x16'
href='/favicon-16x16.png'
/>
<link
rel='manifest'
href='/site.webmanifest'
/>
<link
rel='mask-icon'
href='/safari-pinned-tab.svg'
color='#5bbad5'
/>
<meta
name='msapplication-TileColor'
content='#00a300'
/>
<meta
name='theme-color'
content='#ffffff'
/>

<!-- Optional: Bootstrap Icons -->
<link
rel='stylesheet'
href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css'
/>
<!-- Optional: Bootstrap Icons -->
<link
rel='stylesheet'
href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css'
/>
</head>
Loading

0 comments on commit 46174af

Please sign in to comment.