feat: added a hidden toggle availible in frontmatter which renders the note unlisted, also updated agent behavior with a compliance skill
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
{% extends "layouts/base.njk" %}
|
||||
|
||||
{% block head %}
|
||||
{% if hidden and hidden != "false" and hidden != "0" and hidden != "no" %}
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="article-workspace-grid">
|
||||
<!-- Left Sticky Sidebar: Document Outline & Telemetry -->
|
||||
@@ -26,10 +32,17 @@
|
||||
<div class="sidebar-tile">
|
||||
<div class="sidebar-heading">DISPATCH TELEMETRY</div>
|
||||
<div class="sidebar-stats-box" style="padding: 0; background: transparent; border: none;">
|
||||
{% if hidden and hidden != "false" and hidden != "0" and hidden != "no" %}
|
||||
<div class="stat-row">
|
||||
<span>VISIBILITY:</span>
|
||||
<span class="stat-val" style="color: var(--accent-amber);">UNLISTED</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="stat-row">
|
||||
<span>PUBLISHED:</span>
|
||||
<span class="stat-val">{{ date | postDate }}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat-row">
|
||||
<span>DURATION:</span>
|
||||
<span class="stat-val">{{ content | readingTime(readingTime) }}</span>
|
||||
|
||||
@@ -56,4 +56,62 @@ export function postComparator(a, b) {
|
||||
return timeB - timeA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a post is marked as hidden.
|
||||
* Hidden posts are accessible via direct link/URL, but excluded
|
||||
* from public post lists, indexes, and tag collections.
|
||||
* Supports explicit boolean, string ("true", "yes", "1"), or numeric representations.
|
||||
*
|
||||
* @param {object} item Eleventy page / post object
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isPostHidden(item) {
|
||||
if (!item || typeof item !== "object") return false;
|
||||
const data = item.data ?? item;
|
||||
if (!data || typeof data !== "object") return false;
|
||||
const hidden = data.hidden;
|
||||
if (typeof hidden === "string") {
|
||||
const lower = hidden.trim().toLowerCase();
|
||||
return lower === "true" || lower === "yes" || lower === "1";
|
||||
}
|
||||
if (typeof hidden === "number") {
|
||||
return hidden === 1;
|
||||
}
|
||||
return Boolean(hidden);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a post is marked as a draft.
|
||||
*
|
||||
* @param {object} item Eleventy page / post object
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isPostDraft(item) {
|
||||
if (!item || typeof item !== "object") return false;
|
||||
const data = item.data ?? item;
|
||||
if (!data || typeof data !== "object") return false;
|
||||
const draft = data.draft;
|
||||
if (typeof draft === "string") {
|
||||
const lower = draft.trim().toLowerCase();
|
||||
return lower === "true" || lower === "yes" || lower === "1";
|
||||
}
|
||||
if (typeof draft === "number") {
|
||||
return draft === 1;
|
||||
}
|
||||
return Boolean(draft);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a post is eligible for public collections and listings.
|
||||
* A post must be non-draft and non-hidden.
|
||||
*
|
||||
* @param {object} item Eleventy page / post object
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isPostPublic(item) {
|
||||
if (!item || typeof item !== "object") return false;
|
||||
return !isPostDraft(item) && !isPostHidden(item);
|
||||
}
|
||||
|
||||
export default postComparator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user