mirror of
https://github.com/litruv/lit.ruv.wtf.git
synced 2026-07-24 02:36:02 +10:00
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* @typedef {Object} NavLink
|
|
* @property {string} label
|
|
* @property {string} href
|
|
* @property {boolean} [external]
|
|
*/
|
|
|
|
/** @type {NavLink[]} */
|
|
const NAV_LINKS = [
|
|
{ label: 'home', href: '/' },
|
|
{ label: 'blog', href: '/blog.html' },
|
|
{ label: 'docs', href: '/docs/' },
|
|
{ label: 'github', href: 'https://github.com/litruv', external: true },
|
|
{ label: 'bluesky', href: 'https://bsky.app/profile/lit.mates.dev', external: true },
|
|
{ label: 'materials', href: '/materials' },
|
|
];
|
|
|
|
/**
|
|
* Renders nav link `<a>` elements as an HTML string.
|
|
*
|
|
* @param {string} [indent=' '] - Leading whitespace for each line.
|
|
* @returns {string}
|
|
*/
|
|
function renderNavLinkItems(indent = ' ') {
|
|
return NAV_LINKS.map(({ label, href, external }) => {
|
|
const attrs = external ? ' target="_blank" rel="noopener"' : '';
|
|
return `${indent}<a href="${href}"${attrs} class="quick-link">${label}</a>`;
|
|
}).join('\n');
|
|
}
|
|
|
|
module.exports = { NAV_LINKS, renderNavLinkItems };
|