<%- include("../../../src/web/views/partials/layout-top", { title }) %>
<section class="card">
  <div class="section-header">
    <div>
      <span class="eyebrow">Knowledge</span>
      <h1><%= entry.title %></h1>
      <p class="hint"><%= entry.category || "General" %> · Updated <%= new Date(entry.updated_at).toLocaleString() %></p>
    </div>
    <a class="button subtle" href="/plugins/okf">Back to OKF</a>
  </div>
  <% if (entry.summary) { %>
  <p><%= entry.summary %></p>
  <% } %>
  <% if (entry.tags && entry.tags.length) { %>
  <p>
    <% entry.tags.forEach((tag) => { %>
    <span class="badge"><%= tag %></span>
    <% }) %>
  </p>
  <% } %>
  <% if (entry.aliases && entry.aliases.length) { %>
  <div class="hint">
    <strong>Related questions</strong>
    <ul>
      <% entry.aliases.forEach((alias) => { %>
      <li><%= alias %></li>
      <% }) %>
    </ul>
  </div>
  <% } %>
</section>

<section class="card">
  <h2>Answer</h2>
  <div class="custom-page-markdown"><%- renderMarkdown(entry.user_markdown) %></div>
</section>

<% if (entry.moderator_markdown) { %>
<section class="card">
  <h2>Moderator support details</h2>
  <div class="custom-page-markdown"><%- renderMarkdown(entry.moderator_markdown) %></div>
</section>
<% } %>

<% if (entry.admin_markdown || entry.ai_facts_markdown || (entry.source_links && entry.source_links.length)) { %>
<section class="card">
  <h2>Admin/internal details</h2>
  <% if (entry.admin_markdown) { %>
  <div class="custom-page-markdown"><%- renderMarkdown(entry.admin_markdown) %></div>
  <% } %>
  <% if (entry.ai_facts_markdown) { %>
  <h3>AI facts</h3>
  <div class="custom-page-markdown"><%- renderMarkdown(entry.ai_facts_markdown) %></div>
  <% } %>
  <% if (entry.source_links && entry.source_links.length) { %>
  <h3>Sources</h3>
  <ul>
    <% entry.source_links.forEach((link) => { %>
    <li><a href="<%= link %>" target="_blank" rel="noopener noreferrer"><%= link %></a></li>
    <% }) %>
  </ul>
  <% } %>
</section>
<% } %>
<%- include("../../../src/web/views/partials/layout-bottom") %>
