Blog Tag Management Guide
Overview
This document explains how blog tags are managed consistently across all 8 supported locales (en, zh, ja, ko, es, de, pt, ru) in the BlockEden.xyz CMS.
Problem Statement
Previously, blog tags were defined inline in each post's front matter without centralized management. This led to:
- Cross-locale tag pollution: Chinese tags appearing on Spanish site (
/es/blog/tags/法定货币/) causing 404 errors - Inconsistent capitalization:
blockchainvsBlockchain,suivsSui - Translation issues: Tags being translated inconsistently or not at all
- No single source of truth: Hard to maintain consistency across 370+ unique tags
Solution: Centralized Tags.yml System
We now use Docusaurus's built-in tags.yml feature to manage tags centrally:
blog/tags.yml # English (canonical)
i18n/zh/docusaurus-plugin-content-blog/tags.yml # Simplified Chinese
i18n/ja/docusaurus-plugin-content-blog/tags.yml # Japanese
i18n/ko/docusaurus-plugin-content-blog/tags.yml # Korean
i18n/es/docusaurus-plugin-content-blog/tags.yml # Spanish
i18n/de/docusaurus-plugin-content-blog/tags.yml # German
i18n/pt/docusaurus-plugin-content-blog/tags.yml # Portuguese
i18n/ru/docusaurus-plugin-content-blog/tags.yml # Russian
Tag Categories
Tags are categorized into groups with different translation rules:
1. Blockchain Networks (Never Translate)
Keep in English across all locales:
Ethereum,Sui,Aptos,Bitcoin,Solana,Cardano,Polygon
Example:
# blog/tags.yml
Ethereum:
label: 'Ethereum'
permalink: '/ethereum'
description: 'Articles about Ethereum blockchain'
# i18n/zh/docusaurus-plugin-content-blog/tags.yml
Ethereum:
label: 'Ethereum' # Keep in English
permalink: '/ethereum'
description: '关于以太坊区块链、智能合约和生态系统的文章' # Translate description
2. Technical Protocols (Never Translate)
Keep in English:
Web3,DeFi,NFT,API,DAO,Layer 2,zkp
3. Crypto/Finance Terms (Never Translate)
Keep in English:
crypto,stablecoins,tokenization,staking,MEV
4. General Business Terms (Always Translate)
Translate to target language:
product→产品(zh),producto(es),製品(ja)company→公司(zh),empresa(es),会社(ja)partnership→合作伙伴关系(zh),asociación(es)
5. Industry Terms (Translate)
Translate to target language:
blockchain→区块链(zh),Blockchain(es),ブロックチェーン(ja)fintech→金融科技(zh),fintech(es),フィンテック(ja)security→安全(zh),Seguridad(es),セキュリティ(ja)
File Structure
English Tags (blog/tags.yml)
# Blockchain Networks (keep in English)
Ethereum:
label: 'Ethereum'
permalink: '/ethereum'
description: 'Articles about Ethereum blockchain'
# Business Terms (translate)
product:
label: 'Product'
permalink: '/product'
description: 'Product updates and announcements'
Localized Tags (i18n/{locale}/docusaurus-plugin-content-blog/tags.yml)
# Spanish (i18n/es/docusaurus-plugin-content-blog/tags.yml)
Ethereum:
label: 'Ethereum' # Keep in English
permalink: '/ethereum'
description: 'Artículos sobre blockchain de Ethereum'
product:
label: 'Producto' # Translated
permalink: '/product'
description: 'Actualizaciones y anuncios de productos'
How It Works
1. Blog Plugin Configuration
In docusaurus.config.ts:
blog: {
// ... other config
tags: "tags.yml",
onInlineTags: "warn", // Warn about tags not in tags.yml
},
2. Using Tags in Blog Posts
In blog post front matter, reference tags by their key from tags.yml:
---
title: "My Blog Post"
tags: [Ethereum, product, blockchain] # Use keys from tags.yml
---
3. Automatic Tag Mapping
The translation script (scripts/i18n.js) automatically:
- Extracts tags from English blog post
- Translates the post content
- Maps tags to locale-specific versions using
tags.yml - Updates the translated post with correct tags
Scripts
1. Fix Existing Blog Tags
Fix tags in already-translated blog posts:
# Dry run (check what would be fixed)
node scripts/fix-blog-tags.js --dry-run
# Fix all locales
node scripts/fix-blog-tags.js
# Fix specific locale(s)
node scripts/fix-blog-tags.js es
node scripts/fix-blog-tags.js zh ja ko
Output:
╔═════════════════════════════════════════════════════════╗
║ Blog Tags Fix Script - BlockEden.xyz CMS ║
╚═════════════════════════════════════════════════════════╝
Mode: WRITE (changes will be saved)
Locales: es
============================================================
Fixing locale: ES
============================================================
✏️ 2025-09-27-wall-street-macro-shift.md:
Current: [cambio macroeconómico, 法定货币, criptomonedas]
Updated: [cambio macroeconómico, moneda fiduciaria, criptomonedas]
✓ 2025-02-21-cardano-research.md: Tags already correct
Results for es:
Checked: 246 files
Fixed: 1 files
============================================================
OVERALL SUMMARY
============================================================
Total locales processed: 1
Total files fixed: 1
✅ All done! Blog tags have been fixed.
2. Translate New Blog Posts
When you run the translation script, it will automatically map tags:
yarn i18n
The script will:
- Translate blog post content
- Extract English tags
- Map to locale-specific tags
- Save with correct tags
Adding New Tags
Step 1: Add to English tags.yml
Edit blog/tags.yml:
# New blockchain network
Base:
label: 'Base'
permalink: '/base'
description: 'Articles about Base Layer 2 network'
# New business term
ecosystem:
label: 'Ecosystem'
permalink: '/ecosystem'
description: 'Blockchain ecosystem news and updates'