• English
  • Annual Plans & Site Stats

    The homepage of ModernDuang can display two motivational widgets: Annual Plans — a progress tracker for your goals — and Site Stats — a live counter showing your site's uptime and a countdown to a ten-year milestone.

    Annual Plans (plans)

    The annual plans section lets you publicly track goals, whether personal, professional, or blog-related. Each plan has a description, completion status, and optional progress counters.

    Configuration

    Configured under the plans key in _config.modernduang.yml:

    plans:
      - text: 完成自定义博客主题的开发
        done: true
        current: 1
        final: 1
      - text: 至少撰写10篇博客
        done: false
        current: 7
        final: 10
      - text: 跑完人生首个半程马拉松
        done: false
        current: 0
        final: 1
      - text: 学习 Rust 编程语言
        done: false
        current: 3
        final: 12
    PropertyTypeDefaultDescription
    textstringPlan/goal description
    donebooleanfalseWhether the plan is fully completed
    currentnumber0Current progress count (hours, chapters, posts, etc.)
    finalnumber1Target count

    How Plans Are Displayed

    Each plan item is rendered as a card in a list on the homepage:

    ┌──────────────────────────────────────────────────────┐
    │  Annual Plans                           [75% ████░░] │
    │                                                      │
    │  ✅ 完成自定义博客主题的开发         100% (1/1)      │
    │  🔄 至少撰写10篇博客                  70% (7/10)     │
    │  ⏳ 跑完人生首个半程马拉松             0% (0/1)      │
    │  🔄 学习 Rust 编程语言                25% (3/12)     │
    └──────────────────────────────────────────────────────┘

    Behavior Rules

    • When done: true, the plan shows a checkmark (✅) and is styled as completed (muted colors, strikethrough text if preferred)
    • When done: false and final > 1, a progress tag shows current/final (e.g., 7/10) along with a percentage
    • When done: false and final == 1 with current == 0, the plan shows an hourglass (⏳) indicating "not yet started"
    • When done: false and final == 1 with current > 0, the plan shows a spinner (🔄) indicating "in progress"

    Overall Progress

    At the top of the section, an overall progress bar is calculated automatically:

    • Each plan contributes equally to the total (all plans have equal weight)
    • A completed plan (done: true) counts as 100% for that plan
    • An in-progress plan counts as (current / final) * 100%
    • The overall percentage is the average across all plans
    # Example: 3 plans
    # Plan 1: done (100%)      → 1.00
    # Plan 2: 7/10 (70%)        → 0.70
    # Plan 3: 0/1 (0%)          → 0.00
    # Overall: (1.00 + 0.70 + 0.00) / 3 = 56.7%

    Toggling the Widgets

    The site stats widget is disabled by default (siteStats.enable defaults to false). To show it, set siteStats.enable: true. When disabled, the entire site stats section (uptime counter and ten-year countdown) will not be rendered on the homepage.

    Site Stats (siteStats)

    The site stats widget displays two counters: an uptime counter showing how long your site has been running, and a ten-year promise countdown tracking progress toward a decade-long commitment.

    Configuration

    siteStats:
      enable: false
      startDate: '2024-01-01'
    PropertyTypeDefaultDescription
    enablebooleanfalseWhether to show the site stats widget on homepage
    startDatestring'2024-01-01'Site launch date in YYYY-MM-DD format

    Uptime Counter

    The uptime counter calculates the elapsed time since startDate and displays it as:

    本站已运行 2年182天

    The calculation accounts for leap years and updates live on the page via JavaScript, counting up every second. It shows:

    • Years and days (e.g., "2年182天")
    • If less than 1 year, shows months and days
    • If less than 1 month, shows days only
    • If less than 1 day, shows hours, minutes, and seconds

    Ten-Year Promise Countdown

    The ten-year countdown automatically computes the end date as startDate + 10 years and displays a progress bar and percentage:

    十年之约 ████████████░░░░░░░░ 45.2%

    The percentage formula is:

    elapsed = today - startDate
    total   = 10 years (3652 days)
    percent = (elapsed / total) * 100

    For example, with startDate: '2024-01-01':

    • On 2024-01-01: 0.0% (just started)
    • On 2029-01-01: 50.0% (halfway)
    • On 2034-01-01: 100.0% (milestone reached)

    What Is the Ten-Year Promise?

    The "十年之约" (Ten-Year Promise) is a community tradition among Chinese bloggers — a public commitment to keep blogging for at least ten years. Displaying the countdown on your site is both a personal motivator and a signal to readers that you are in it for the long haul.

    Complete Example

    # _config.modernduang.yml
    
    plans:
      - text: 完成博客主题 ModernDuang 的开发
        done: true
        current: 1
        final: 1
      - text: 撰写至少12篇技术博客
        done: false
        current: 8
        final: 12
      - text: 完成《深入理解计算机系统》阅读
        done: false
        current: 5
        final: 12
      - text: 参加一次技术会议并做分享
        done: false
        current: 0
        final: 1
      - text: 学习 Rust 并贡献一个开源项目
        done: false
        current: 0
        final: 1
    
    siteStats:
      enable: true
      startDate: '2024-03-15'

    The homepage will render:

    ┌──────────────────────────────────────────────────────┐
    │  Annual Plans                           [52% ████░░] │
    │                                                      │
    │  ✅ 完成博客主题 ModernDuang 的开发    100% (1/1)   │
    │  🔄 撰写至少12篇技术博客                67% (8/12)   │
    │  🔄 完成《深入理解计算机系统》阅读      42% (5/12)   │
    │  ⏳ 参加一次技术会议并做分享             0% (0/1)    │
    │  ⏳ 学习 Rust 并贡献一个开源项目         0% (0/1)    │
    └──────────────────────────────────────────────────────┘
    
    ┌──────────────────────────────────────────────────────┐
    │  本站已运行 2年112天                                  │
    │  十年之约 ██████░░░░░░░░ 22.5%                       │
    └──────────────────────────────────────────────────────┘