Add meta tags element
This commit is contained in:
parent
b81c4a10f0
commit
4d3e2cc775
1 changed files with 26 additions and 0 deletions
|
@ -56,3 +56,29 @@ impl<T: AsRef<str>> Render for Js<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate <meta> elements.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![feature(plugin)]
|
||||
/// # #![plugin(maud_macros)]
|
||||
/// # extern crate maud;
|
||||
/// # extern crate maud_extras;
|
||||
/// # use maud_extras::*;
|
||||
/// # fn main() {
|
||||
/// let m = Meta("description", "test description");
|
||||
/// assert_eq!(html!{ (m) }.into_string(),
|
||||
/// r#"<meta name="description" content="test description">"#);
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct Meta<T: AsRef<str>, U: AsRef<str>>(pub T, pub U);
|
||||
|
||||
impl<T: AsRef<str>, U: AsRef<str>> Render for Meta<T, U> {
|
||||
fn render(&self) -> Markup {
|
||||
html! {
|
||||
meta name=(self.0.as_ref()) content=(self.1.as_ref()) /
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue