Skip to content

Commit

Permalink
seo updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lorant-one committed Aug 19, 2024
1 parent 81b6b0a commit 5ba8997
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 29 deletions.
4 changes: 4 additions & 0 deletions src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export default function Blog() {
author: {
'@type': 'Person',
name: person.name,
image: {
'@type': 'ImageObject',
url: `${baseURL}/images/avatar.png`,
},
},
}),
}}
Expand Down
33 changes: 33 additions & 0 deletions src/app/gallery/components/MasonryGrid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use client";

import Masonry from 'react-masonry-css';
import { SmartImage } from "@/once-ui/components";
import { gallery } from "@/app/resources";
import styles from "@/app/gallery/Gallery.module.scss";

export default function MasonryGrid() {
const breakpointColumnsObj = {
default: 4,
1440: 3,
1024: 2,
560: 1
};

return (
<Masonry
breakpointCols={breakpointColumnsObj}
className={styles.masonryGrid}
columnClassName={styles.masonryGridColumn}>
{gallery.images.map((image, index) => (
<SmartImage
key={index}
radius="m"
aspectRatio={image.orientation === "horizontal" ? "16 / 9" : "9 / 16"}
src={image.src}
alt={image.alt}
className={styles.gridItem}
/>
))}
</Masonry>
);
}
87 changes: 60 additions & 27 deletions src/app/gallery/page.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,66 @@
"use client";
import { Flex } from "@/once-ui/components";
import MasonryGrid from "./components/MasonryGrid";
import { baseURL, gallery, person } from "../resources";

import Masonry from 'react-masonry-css';
import { SmartImage } from "@/once-ui/components";
import { gallery } from "@/app/resources";
import styles from "@/app/gallery/Gallery.module.scss";
export function generateMetadata() {
const title = gallery.title;
const description = gallery.description;
const ogImage = `https://${baseURL}/og?title=${encodeURIComponent(title)}`;

export default function Gallery() {
const breakpointColumnsObj = {
default: 4,
1440: 3,
1024: 2,
560: 1
};
return {
title,
description,
openGraph: {
title,
description,
type: 'website',
url: `https://${baseURL}/gallery`,
images: [
{
url: ogImage,
alt: title,
},
],
},
twitter: {
card: 'summary_large_image',
title,
description,
images: [ogImage],
},
};
}

export default function Gallery() {
return (
<Masonry
breakpointCols={breakpointColumnsObj}
className={styles.masonryGrid}
columnClassName={styles.masonryGridColumn}>
{gallery.images.map((image, index) => (
<SmartImage
key={index}
radius="m"
aspectRatio={image.orientation === "horizontal" ? "16 / 9" : "9 / 16"}
src={image.src}
alt={image.alt}
className={styles.gridItem}
/>
))}
</Masonry>
<Flex fillWidth>
<script
type="application/ld+json"
suppressHydrationWarning
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'ImageGallery',
name: gallery.title,
description: gallery.description,
url: `https://${baseURL}/gallery`,
image: gallery.images.map((image) => ({
'@type': 'ImageObject',
url: `${baseURL}${image.src}`,
description: image.alt,
})),
author: {
'@type': 'Person',
name: person.name,
image: {
'@type': 'ImageObject',
url: `${baseURL}/images/avatar.png`,
},
},
}),
}}
/>
<MasonryGrid/>
</Flex>
);
}
53 changes: 52 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,66 @@ import React from 'react';
import { Heading, Flex, Text, Button, Avatar } from '@/once-ui/components';
import { Projects } from '@/app/work/components/Projects';

import { home } from '@/app/resources'
import { baseURL, home, person } from '@/app/resources'
import { Mailchimp } from '@/app/components';
import { Posts } from '@/app/blog/components/Posts';

export function generateMetadata() {
const title = home.title;
const description = home.description;
const ogImage = `https://${baseURL}/og?title=${encodeURIComponent(title)}`;

return {
title,
description,
openGraph: {
title,
description,
type: 'website',
url: `https://${baseURL}/blog`,
images: [
{
url: ogImage,
alt: title,
},
],
},
twitter: {
card: 'summary_large_image',
title,
description,
images: [ogImage],
},
};
}

export default function Home() {
return (
<Flex
maxWidth="m" fillWidth gap="24"
direction="column" alignItems="center">
<script
type="application/ld+json"
suppressHydrationWarning
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'https://schema.org',
'@type': 'WebPage',
name: home.title,
description: home.description,
url: `https://${baseURL}`,
image: `${baseURL}/og?title=${encodeURIComponent(home.title)}`,
publisher: {
'@type': 'Person',
name: person.name,
image: {
'@type': 'ImageObject',
url: `${baseURL}/images/avatar.png`,
},
},
}),
}}
/>
<Flex
fillWidth
direction="column"
Expand Down
3 changes: 2 additions & 1 deletion src/app/resources/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ const work = {

const gallery = {
label: 'Gallery',
title: 'Gallery',
title: 'My photo gallery',
description: `A photo collection by ${person.name}`,
images: [
{
src: '/images/gallery/img-01.jpg',
Expand Down

0 comments on commit 5ba8997

Please sign in to comment.