{# CV Page Builder Sidebar — renders widgets from cvPageConfig.sidebar #}
{% if cvPageConfig.sidebar and cvPageConfig.sidebar.length %}
  {% for widget in cvPageConfig.sidebar %}
    {% if widget.type == "recent-comments" or widget.type == "categories" or widget.type == "post-categories" %}
      {# Hidden sidebar widgets by request #}
    {% elif widget.type == "author-card" %}
      {% include "components/widgets/author-card.njk" %}
    {% elif widget.type == "social-activity" %}
      {% include "components/widgets/social-activity.njk" %}
    {% elif widget.type == "github-repos" %}
      {% include "components/widgets/github-repos.njk" %}
    {% elif widget.type == "funkwhale" %}
      {% include "components/widgets/funkwhale.njk" %}
    {% elif widget.type == "recent-posts" %}
      {% include "components/widgets/recent-posts.njk" %}
    {% elif widget.type == "blogroll" %}
      {% include "components/widgets/blogroll.njk" %}
    {% elif widget.type == "feedland" %}
      {% include "components/widgets/feedland.njk" %}
    {% elif widget.type == "categories" %}
      {% include "components/widgets/categories.njk" %}
    {% elif widget.type == "search" %}
      {% include "components/widgets/search.njk" %}
    {% elif widget.type == "webmentions" %}
      {% include "components/widgets/webmentions.njk" %}
    {% elif widget.type == "custom-html" %}
      {# Custom content widget #}
      {% set wConfig = widget.config or {} %}
      <is-land on:visible>
      <div class="widget">
        {% if wConfig.title %}
        <h3 class="widget-title">{{ wConfig.title }}</h3>
        {% endif %}
        {% if wConfig.content %}
        <div class="prose dark:prose-invert prose-sm max-w-none">
          {{ wConfig.content | safe }}
        </div>
        {% endif %}
      </div>
      </is-land>
    {% else %}
      <!-- Unknown widget type: {{ widget.type }} -->
    {% endif %}
  {% endfor %}
{% endif %}
