Skip to content

Commit d1a1ded

Browse files
author
OpenClaw Sync
committed
Auto TOC: show when 6+ headings, suppress with toc: false
1 parent 2bacfe4 commit d1a1ded

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

_layouts/post.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,18 @@ <h1>{{ page.title }}</h1>
1919
{% endif %}
2020
</header>
2121

22-
{% if page.toc %}
22+
{% assign headings = content | split: '</h2>' %}
23+
{% assign h2_count = 0 %}
24+
{% for heading in headings %}
25+
{% if heading contains '<h2 id="' %}
26+
{% assign h2_count = h2_count | plus: 1 %}
27+
{% endif %}
28+
{% endfor %}
29+
{% unless page.toc == false %}
30+
{% if h2_count >= 6 %}
2331
<nav class="post-toc" aria-label="Table of contents">
2432
<p class="toc-label">Contents</p>
2533
<ul>
26-
{% assign headings = content | split: '</h2>' %}
2734
{% for heading in headings %}
2835
{% if heading contains '<h2 id="' %}
2936
{% assign h2_part = heading | split: '<h2 id="' | last %}
@@ -35,6 +42,7 @@ <h1>{{ page.title }}</h1>
3542
</ul>
3643
</nav>
3744
{% endif %}
45+
{% endunless %}
3846

3947
<div class="post-content">
4048
{{ content }}

_posts/2026-03-11-nixclaw-declarative-ai-agents-on-nixos.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: "NixClaw: Declarative AI Agents on NixOS"
33
description: How I built a single-purpose NixOS VM that runs AI agents with their own git-backed workspaces, deployed in one command from a MacBook to Proxmox.
4-
toc: true
54
---
65

76
I wanted AI agents I could spin up per-project, each with its own workspace and chat channel, running on infrastructure I control. A proper declarative system where the entire machine — disk layout, services, secrets, agent bindings — lives in version-controlled Nix.

0 commit comments

Comments
 (0)