pvgttm-web/src/layouts/partials/backLink.ejs

34 lines
1.1 KiB
Plaintext

<%
var titlesBySection = {
// top-level
astral: "Astral Info",
campaign: "Campaign Info",
classes: "Character Classes",
"magic-items": "Magic Items",
planes: "Other Planes",
races: "Character Races",
rules: "House Rules",
// planes
elemental: "Elemental Planes",
material: "Material Planes",
transcendental: "Transcendental Planes",
};
%>
<% if (page.subsection && page.path && !page.path.endsWith(`${page.subsection}/index.html`)) { %>
<div class="sectionBackLink-wrapper">
<a href="./index.html" class="sectionBackLink">
&lt; Back to <%= titlesBySection[page.subsection] ?? page.subsection.charAt(0).toUpperCase() + page.subsection.slice(1) %>
</a>
</div>
<% } else if (page.section && page.path && !page.path.endsWith(`${page.section}/index.html`)) { -%>
<div class="sectionBackLink-wrapper">
<a href="<%=page.subsection ? '..' : '.'-%>/index.html" class="sectionBackLink">
&lt; Back to <%= titlesBySection[page.section] ?? page.section.charAt(0).toUpperCase() + page.section.slice(1) %>
</a>
</div>
<% } -%>