#fn-sitemap {
–fn-primary: #1b6b46;
–fn-primary-light: #edf7f1;
–fn-border: #e2e8f0;
–fn-text: #1e293b;
–fn-muted: #64748b;
–fn-bg: #ffffff;
font-family: inherit;
color: var(–fn-text);
line-height: 1.6;
margin: 20px 0;
}
#fn-sitemap * {
box-sizing: border-box;
}
.fn-header {
margin-bottom: 20px;
}
.fn-desc {
margin: 0 0 16px;
color: var(–fn-muted);
font-size: 0.95rem;
}
.fn-controls {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
}
.fn-search {
flex: 1 1 260px;
padding: 10px 14px;
border: 1px solid var(–fn-border);
border-radius: 8px;
font-size: 0.95rem;
outline: none;
transition: border-color 0.2s;
}
.fn-search:focus {
border-color: var(–fn-primary);
}
.fn-stats {
font-size: 0.85rem;
color: var(–fn-muted);
background: var(–fn-primary-light);
color: var(–fn-primary);
padding: 6px 12px;
border-radius: 999px;
font-weight: 600;
}
.fn-cat-nav {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 22px;
}
.fn-cat-pill {
display: inline-block;
padding: 5px 12px;
font-size: 0.85rem;
background: #f8fafc;
border: 1px solid var(–fn-border);
border-radius: 6px;
color: var(–fn-text);
text-decoration: none;
transition: all 0.2s;
}
.fn-cat-pill:hover {
background: var(–fn-primary);
color: #fff;
border-color: var(–fn-primary);
}
.fn-group {
border: 1px solid var(–fn-border);
border-radius: 10px;
margin-bottom: 16px;
background: var(–fn-bg);
overflow: hidden;
}
.fn-group summary {
list-style: none;
cursor: pointer;
padding: 14px 18px;
background: #f8fafc;
font-weight: 700;
font-size: 1.05rem;
color: var(–fn-primary);
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(–fn-border);
}
.fn-group summary::-webkit-details-marker {
display: none;
}
.fn-group:not([open]) summary {
border-bottom: none;
}
.fn-count {
font-size: 0.8rem;
font-weight: 600;
background: var(–fn-primary-light);
color: var(–fn-primary);
padding: 2px 10px;
border-radius: 999px;
}
.fn-list {
list-style: none;
margin: 0;
padding: 8px 18px 14px;
}
.fn-item {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 12px;
padding: 8px 0;
border-bottom: 1px dashed var(–fn-border);
}
.fn-item:last-child {
border-bottom: none;
}
.fn-link {
color: var(–fn-text);
text-decoration: none;
font-size: 0.95rem;
transition: color 0.15s;
}
.fn-link:hover {
color: var(–fn-primary);
text-decoration: underline;
}
.fn-date {
flex-shrink: 0;
font-size: 0.8rem;
color: var(–fn-muted);
}
.fn-status {
text-align: center;
padding: 28px 16px;
color: var(–fn-muted);
font-size: 0.95rem;
}
@media (max-width: 600px) {
.fn-item {
flex-direction: column;
gap: 2px;
}
}
(function () {
const SITE_URL = ‘https://www.faunesia.com’;
const MAX_RESULTS = 150;
let startIndex = 1;
const allPosts = [];
const contentEl = document.getElementById(‘fn-sitemap-content’);
const navEl = document.getElementById(‘fn-cat-nav’);
const statsEl = document.getElementById(‘fn-total-stats’);
const searchInput = document.getElementById(‘fn-search-input’);
function escapeHtml(str) {
return String(str).replace(/[&”‘]/g, function (m) {
return { ‘&’: ‘&’, ”: ‘>’, ‘”‘: ‘"’, “‘”: ‘'’ }[m];
});
}
function formatDate(isoStr) {
const d = new Date(isoStr);
if (isNaN(d)) return ”;
return d.toLocaleDateString(‘id-ID’, {
day: ‘2-digit’,
month: ‘short’,
year: ‘numeric’
});
}
function createSlug(text) {
return ‘cat-‘ + text.toLowerCase().replace(/[^a-z0-9]+/g, ‘-‘).replace(/(^-|-$)/g, ”);
}
function fetchFeed(index) {
const script = document.createElement(‘script’);
script.src =
SITE_URL +
‘/feeds/posts/summary?alt=json-in-script&max-results=’ +
MAX_RESULTS +
‘&start-index=’ +
index +
‘&callback=window.__fnSitemapCb’;
script.async = true;
script.onerror = function () {
contentEl.innerHTML =
‘
‘;
statsEl.textContent = ‘Gagal memuat’;
};
document.body.appendChild(script);
}
window.__fnSitemapCb = function (data) {
const entries = (data.feed && data.feed.entry) ? data.feed.entry : [];
entries.forEach(function (entry) {
const title = entry.title ? entry.title.$t : ‘Tanpa Judul’;
const altLink = entry.link ? entry.link.find(function (l) { return l.rel === ‘alternate’; }) : null;
const url = altLink ? altLink.href : ‘#’;
const published = entry.published ? entry.published.$t : ”;
const labels = entry.category && entry.category.length
? entry.category.map(function (c) { return c.term; })
: [‘Artikel Umum’];
allPosts.push({ title: title, url: url, published: published, labels: labels });
});
if (entries.length === MAX_RESULTS) {
startIndex += MAX_RESULTS;
fetchFeed(startIndex);
} else {
renderSitemap(allPosts);
}
};
function renderSitemap(posts, query) {
const keyword = (query || ”).trim().toLowerCase();
const grouped = {};
posts.forEach(function (post) {
const matchTitle = post.title.toLowerCase().includes(keyword);
post.labels.forEach(function (label) {
const matchLabel = label.toLowerCase().includes(keyword);
if (!keyword || matchTitle || matchLabel) {
if (!grouped[label]) grouped[label] = [];
grouped[label].push(post);
}
});
});
const sortedLabels = Object.keys(grouped).sort(function (a, b) {
return a.localeCompare(b, ‘id’);
});
statsEl.textContent = posts.length + ‘ Artikel’;
if (sortedLabels.length === 0) {
navEl.innerHTML = ”;
contentEl.innerHTML =
‘
escapeHtml(query) +
‘”.
‘;
return;
}
let navHtml = ”;
let bodyHtml = ”;
sortedLabels.forEach(function (label) {
const slug = createSlug(label);
const items = grouped[label];
navHtml +=
‘‘ +
escapeHtml(label) + ‘ (‘ + items.length + ‘)‘;
bodyHtml += ‘
bodyHtml +=
‘
‘ + escapeHtml(label) + ‘‘ +
‘‘ + items.length + ‘ artikel
‘;
bodyHtml += ‘
- ‘;
- ‘ +
‘‘ + escapeHtml(item.title) + ‘‘ +
‘‘ + formatDate(item.published) + ‘‘ +
‘
items.forEach(function (item) {
bodyHtml +=
‘
‘;
});
bodyHtml += ‘
‘;
});
navEl.innerHTML = navHtml;
contentEl.innerHTML = bodyHtml;
}
searchInput.addEventListener(‘input’, function (e) {
renderSitemap(allPosts, e.target.value);
});
fetchFeed(startIndex);
})();