# Meta.json Generation Utilities # Functions for generating meta.json files with category and tag emoji mappings use frontmatter.nu collect_categories_and_tags # Default emoji mappings for categories export def get_default_category_emojis [] { { "architecture": "πŸ›οΈ", "devops": "πŸ› οΈ", "infrastructure": "πŸ—οΈ", "rust": "πŸ¦€", "web3": "⛓️", "blockchain": "πŸ’Ž", "web-development": "🌐", "docker": "🐳", "kubernetes": "☸️", "ci-cd": "πŸ”„", "async-programming": "🌊", "rust-programming": "πŸ¦€", "frontend": "πŸ’»", "backend": "βš™οΈ", "programacion-asincrona": "🌊", "programacion-rust": "πŸ¦€", "cicd": "πŸ”„" } } # Default emoji mappings for tags export def get_default_tag_emojis [] { { "rust": "πŸ¦€", "leptos": "⚑", "axum": "πŸ”§", "web-development": "🌐", "architecture": "πŸ›οΈ", "devops": "πŸ› οΈ", "infrastructure": "πŸ—οΈ", "docker": "🐳", "kubernetes": "☸️", "ci-cd": "πŸ”„", "blockchain": "πŸ’Ž", "web3": "⛓️", "microservices": "πŸ”—", "self-hosted": "🏠", "patterns": "πŸ“", "performance": "⚑", "testing": "πŸ§ͺ", "security": "πŸ”’", "monitoring": "πŸ“Š", "deployment": "πŸš€", "api": "πŸ”Œ", "database": "πŸ—„οΈ", "frontend": "πŸ’»", "backend": "βš™οΈ", "terraform": "🌍", "error-handling": "πŸ›‘οΈ", "async": "⚑", "syntax": "🎨", "highlighting": "πŸ–οΈ", "smart-contracts": "πŸ“œ", "iac": "🏭", "gitlab": "🦊", "async-programming": "🌊", "rust-programming": "πŸ¦€", "optimization": "πŸ’‘", "best-practices": "⭐" } } # Create emoji mappings for categories and tags export def create_emoji_mappings [categories: list, tags: list] { let category_defaults = get_default_category_emojis let tag_defaults = get_default_tag_emojis mut categories_emojis = {} mut tags_emojis = {} # Assign emojis to categories for category in $categories { if $category in $category_defaults { $categories_emojis = ($categories_emojis | insert $category ($category_defaults | get $category)) } else { $categories_emojis = ($categories_emojis | insert $category "πŸ“‚") } } # Assign emojis to tags for tag in $tags { if $tag in $tag_defaults { $tags_emojis = ($tags_emojis | insert $tag ($tag_defaults | get $tag)) } else { $tags_emojis = ($tags_emojis | insert $tag "🏷️") } } { categories_emojis: $categories_emojis, tags_emojis: $tags_emojis } } # Generate meta.json file with categories and tags emojis export def generate_meta_json [content_type: string, lang: string, source_dir: string, target_dir: string] { let meta_file = $"($target_dir)/meta.json" print $"(ansi blue) - Generating meta.json for ($content_type) ($lang)...(ansi reset)" # Collect categories and tags from markdown files let collected = collect_categories_and_tags $source_dir # Create emoji mappings let emoji_mappings = create_emoji_mappings $collected.categories $collected.tags # Save to JSON file $emoji_mappings | to json | save --force $meta_file let categories_count = ($collected.categories | length) let tags_count = ($collected.tags | length) print $"(ansi green) βœ… Meta file: ($meta_file) - categories: ($categories_count), tags: ($tags_count)(ansi reset)" }