ES

@core / seo

1.0.0 ▾
verificadoMIT
GitHub

SEO para sitios GenPM: metadatos con canónica y hreflang, sitemaps troceados, robots.txt, llms.txt y JSON-LD seguro

Código9 archivosContexto~639 tokensescaneo superado

El árbol exacto que se inyectará, tras aplicar .genpmignore. Anclado a

src/lib/seo/adapters/hono.tssolo lectura · cf4e3c3
// Adaptador Hono: `app.route('/', seoRoutes())` → /sitemap.xml, /sitemaps/:name/:n.xml y /robots.txt.
import { Hono } from 'hono';
import { robotsTxt, sitemapChunkXml, sitemapIndexXml } from '../index.ts';

const XML = { 'content-type': 'application/xml; charset=utf-8', 'cache-control': 'public, max-age=3600' };

export function seoRoutes(opts: { disallow?: string[] } = {}) {
  return new Hono()
    .get('/sitemap.xml', async (c) => c.body(await sitemapIndexXml(), 200, XML))
    .get('/sitemaps/:name/:file', async (c) => {
      const m = /^(\d{1,4})\.xml$/.exec(c.req.param('file'));
      const body = m ? await sitemapChunkXml(c.req.param('name'), Number(m[1])) : null;
      return body ? c.body(body, 200, XML) : c.notFound();
    })
    .get('/robots.txt', (c) => c.text(robotsTxt(opts)));
}

Reportar @core/seo

Inicia sesión con GitHub para reportar un paquete.