SEO and SMO meta tags
Astro Plugins
These are the most popular plugins for the task:
- astro-seo β: This Astro component makes it easy to add tags relevant for search engine optimization (SEO) to your pages.
- @astrolib/seo β: Astro SEO is an integration that makes managing your SEO easier in Astro projects. It is fully based on the excellent Next SEO library.
- astro-seo-meta β: Astro SEO provides an SEO component to update meta tags.
- astro-seo-schema β: Easily insert valid Schema.org JSON-LD in your Astro apps.
Metadata
type: NewsArticle
-
Install dependencies
Terminal window pnpm add schema-dts astro-seo-schema -
Add
Schema
toHead
src/components/Head.astro ---import Default from "@astrojs/starlight/components/Head.astro";import { Schema } from "astro-seo-schema";---<Default {...Astro.props}><slot /></Default><Schemaitem={{"@context": "https://schema.org","@type": "NewsArticle",dateModified: Astro.locals.starlightRoute.lastUpdated?.toISOString(),headline: Astro.locals.starlightRoute.entry.data.title,author: [{"@type": "Person",name: "stereobooster",url: "https://stereobooster.com",},],}}/> -
Change Astro config
astro.config.mjs export default defineConfig({integrations: [starlight({components: {Head: "./src/components/Head.astro",},lastUpdated: true,}),],});
type: Article
Try "@type":"Article"
with the following elements:
<article>
<span itemprop="dateModified" content="2020-Mar-13">
<h1 itemprop="name">...</h1>
<div itemprop="articleBody">...</div>
Sites to Test Meta Tags
TODO
- Plugin that places sitemap URL in
robots.txt
(astro-robots-txt
) - Use the βupdated atβ date in the sitemap (so search engines would rescan those pages first)
- Maybe I can use BrainDb to generate it?