Skip to content

meta ​

Document meta, OG/Twitter, JSON-LD, and head inject

Cratesova-meta 0.1.2
Plugin idmeta
CategoryContent

Install ​

bash
cargo add sova --features meta

Features ​

FeatureWhat you get
metaSEO head tags, Sitemap, Robots.
meta-i18nLocale-aware meta.
meta-openapiOpenAPI helpers for Meta routes.
meta-storeMeta helpers backed by KvStore.
meta-templatesInject meta into MiniJinja HTML.

Overview ​

When: document title, description, OG/Twitter, JSON-LD, head inject.

Does:

  • Meta::page().title(…).description(…)
  • Route/router .with(Meta::…)
  • Sitemap / robots helpers in crate

Example ​

rust
app.get("/", home).with(Meta::page().title("Home").description("Welcome"));

Quick start ​

App::web() installs Meta + Sitemap + Robots. Set site / public URL on the preset, page tags on routes:

rust
use sova::prelude::*;
use sova::{Html, Meta, Parser, ServerArgs};

#[tokio::main]
async fn main() -> Result<()> {
    let args = ServerArgs::parse();
    args.init_tracing();

    let mut app = App::web()
        .site("Blog")
        .public_url("https://example.com");

    app.get("/about", || async { Html("<h1>About</h1>") })
        .with(
            Meta::page()
                .title("About")
                .description("About the blog"),
        );

    app.run().await
}

Customize sitemap exclusions after into_app() if needed (cabinet excludes /cabinet/*, /api/*, …). Demo: meta_blog.

Examples ​

templates · i18n · openapi