pub fn extract_and_prepare_metadata(content: &str) -> MetadataResultExpand description
Extracts metadata from the content, generates keywords based on the metadata, and prepares meta tag groups.
This function performs three key tasks:
- It extracts metadata from the front matter of the content.
- It generates keywords based on this metadata.
- It generates various meta tags required for the page.
§Arguments
content- A string slice representing the content from which to extract metadata.
§Returns
Returns a Result containing a tuple with:
HashMap<String, String>: Extracted metadataVec<String>: A list of keywordsMetaTagGroups: A structure containing various meta tags
§Errors
This function will return a MetadataError if metadata extraction or processing fails.
§Example
use metadata_gen::extract_and_prepare_metadata;
let content = r#"---
title: My Page
description: A sample page
---
"#;
let result = extract_and_prepare_metadata(content);
assert!(result.is_ok());