Skip to content

Commit

Permalink
Addressing seo issues (tinacms#2808)
Browse files Browse the repository at this point in the history
* rm unused references

* implement fall-back docs seo description

* add backup seo description to blogs

* Update default SEO
  • Loading branch information
joshbermanssw authored Jan 30, 2025
1 parent ce52d6b commit 32b1527
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/blog/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import client from 'tina/__generated__/client';
import BlogPageClient from './BlogPageClient';
import { TinaMarkdownContent } from 'tinacms/dist/rich-text';
import { BlogPost } from './BlogType';
import { getExcerpt } from 'utils/getExcerpt';

export async function generateStaticParams() {
let allPosts = [];
Expand Down Expand Up @@ -47,6 +48,7 @@ export async function generateMetadata({

try {
const { data } = await client.queries.getExpandedPostDocument(vars);
const excerpt = getExcerpt(data.post.body, 140);

if (!data?.post) {
console.warn(`No metadata found for slug: ${slugPath}`);
Expand All @@ -55,8 +57,10 @@ export async function generateMetadata({

return {
title: `${data.post.title} | TinaCMS Blog`,
description: excerpt,
openGraph: {
title: data.post.title,
description: excerpt,
},
};
} catch (error) {
Expand Down
6 changes: 4 additions & 2 deletions app/docs/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import client from 'tina/__generated__/client';
import { getDocsNav } from 'utils/docs/getDocProps';
import getTableOfContents from 'utils/docs/getTableOfContents';
import DocsClient from './DocsPagesClient';
import { getExcerpt } from 'utils/getExcerpt';

export async function generateStaticParams() {
try{
Expand Down Expand Up @@ -31,13 +32,14 @@ export async function generateMetadata({
const slug = params.slug.join('/');
try {
const { data } = await client.queries.doc({ relativePath: `${slug}.mdx` });
const excerpt = getExcerpt(data.doc.body, 140);

return {
title: `${data.doc.seo?.title || data.doc.title} | TinaCMS Docs`,
description: data.doc.seo?.description || '',
description: data.doc.seo?.description || `${excerpt} || TinaCMS Docs`,
openGraph: {
title: data.doc.title,
description: data.doc.seo?.description,
description: data.doc.seo?.description || `${excerpt} || TinaCMS Docs`,
},
};
} catch (error) {
Expand Down
1 change: 0 additions & 1 deletion content/blog/tinacms-ui-whats-next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,3 @@ Packages are scoped to `@tinacms` when they are fundamental pieces of content ma

Join the [TinaCMS Discord Server](https://discord.com/invite/zumN63Ybpf) if you have any questions or comments or if you want to get involved with TinaCMS development.

Learn more about [CMS alerts](/docs/reference/alerts) and the [CMS media store](/docs/reference/media).
7 changes: 6 additions & 1 deletion content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
id: introduction
seo:
title: 'TinaCMS Docs | Get Started and learn about TinaCMS '
description: >-
TinaCMS is an open-source, Git-backed CMS with real-time editing, version
control, and scalability, empowering developers and content creators alike.
title: Tina Docs
last_edited: '2024-11-08T04:50:48.321Z'
last_edited: '2025-01-29T03:47:38.729Z'
next: content/docs/product-tour.mdx
previous: ''
---
Expand Down
2 changes: 1 addition & 1 deletion content/siteConfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Tina",
"sidebarTitle": "Tina",
"seoDefaultTitle": "The Markdown CMS",
"seoDefaultTitle": "TinaCMS – Headless CMS with GitHub & Markdown Support",
"description": "TinaCMS is a fully open-source headless CMS that supports Git",
"siteUrl": "https://tina.io",
"roadmapUrl": "https://tina.io/roadmap/",
Expand Down

0 comments on commit 32b1527

Please sign in to comment.