Skip to content

Commit

Permalink
fix: stega bugs (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan authored Oct 22, 2024
1 parent 9142eb1 commit 383eae3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions components/IndexPageHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import BlogMeta from 'components/BlogMeta'
import * as demo from 'lib/demo.data'
import { Settings } from 'lib/sanity.queries'
import Head from 'next/head'
import { toPlainText } from 'next-sanity'
import { stegaClean, toPlainText } from 'next-sanity'

export interface IndexPageHeadProps {
settings: Settings
Expand All @@ -18,7 +18,7 @@ export default function IndexPageHead({ settings }: IndexPageHeadProps) {

return (
<Head>
<title>{title}</title>
<title>{stegaClean(title)}</title>
<BlogMeta />
<meta
key="description"
Expand Down
5 changes: 4 additions & 1 deletion components/PostPageHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as demo from 'lib/demo.data'
import { urlForImage } from 'lib/sanity.image'
import { Post, Settings } from 'lib/sanity.queries'
import Head from 'next/head'
import { stegaClean } from 'next-sanity'

export interface PostPageHeadProps {
settings: Settings
Expand All @@ -13,7 +14,9 @@ export default function PostPageHead({ settings, post }: PostPageHeadProps) {
const title = settings.title ?? demo.title
return (
<Head>
<title>{post.title ? `${post.title} | ${title}` : title}</title>
<title>
{stegaClean(post.title ? `${post.title} | ${title}` : title)}
</title>
<BlogMeta />
{post.coverImage?.asset?._ref && (
<meta
Expand Down
8 changes: 4 additions & 4 deletions plugins/locate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const locate: DocumentLocationResolver = (params, context) => {
return {
locations: [
{
title: doc.title || 'Untitled',
href: `/posts/${doc.slug.current}`,
title: doc?.title || 'Untitled',
href: `/posts/${doc?.slug?.current}`,
},
{
title: 'Home',
Expand Down Expand Up @@ -58,8 +58,8 @@ export const locate: DocumentLocationResolver = (params, context) => {
map((docs) => {
return {
locations: docs?.map((doc) => ({
title: doc.title || 'Untitled',
href: `/posts/${doc.slug.current}`,
title: doc?.title || 'Untitled',
href: `/posts/${doc?.slug?.current}`,
})),
}
}),
Expand Down

0 comments on commit 383eae3

Please sign in to comment.