93 releases

new 0.8.0-rc1 Apr 11, 2025
0.8.0-beta Mar 19, 2025
0.7.8 Mar 20, 2025
0.7.2 Dec 21, 2024
0.0.3 Nov 27, 2022

#1645 in HTTP server

Download history 5374/week @ 2024-12-25 7734/week @ 2025-01-01 11991/week @ 2025-01-08 12162/week @ 2025-01-15 10294/week @ 2025-01-22 11562/week @ 2025-01-29 12306/week @ 2025-02-05 13199/week @ 2025-02-12 11491/week @ 2025-02-19 15985/week @ 2025-02-26 16913/week @ 2025-03-05 18429/week @ 2025-03-12 16947/week @ 2025-03-19 16005/week @ 2025-03-26 14207/week @ 2025-04-02 12943/week @ 2025-04-09

63,486 downloads per month
Used in 50 crates (35 directly)

MIT license

240KB
4.5K SLoC

Leptos Meta

Leptos Meta allows you to modify content in a document’s <head> from within components using the Leptos web framework.

Document metadata is updated automatically when running in the browser. For server-side rendering, after the component tree is rendered to HTML, ServerMetaContextOutput::inject_meta_context will inject meta tags into a stream of HTML inside the <head>.

use leptos::prelude::*;
use leptos_meta::*;

#[component]
fn MyApp() -> impl IntoView {
    // Provides a [`MetaContext`], if there is not already one provided.
    provide_meta_context();

    let (name, set_name) = create_signal("Alice".to_string());

    view! {
      <Title
        // reactively sets document.title when `name` changes
        text=move || name.get()
        // applies the `formatter` function to the `text` value
        formatter=|text| format!("{text}” is your name")
      />
      <main>
        <input
          prop:value=move || name.get()
          on:input=move |ev| set_name.set(event_target_value(&ev))
        />
      </main>
    }
}

Feature Flags

  • ssr Server-side rendering: Generate an HTML string (typically on the server)
  • tracing Adds integration with the tracing crate.

Important Note: If you’re using server-side rendering, you should enable ssr.

Dependencies

~22–34MB
~546K SLoC