Skip to content

Commit

Permalink
feat: sitemap for spank
Browse files Browse the repository at this point in the history
  • Loading branch information
osmancoskun committed May 18, 2024
1 parent d08bccd commit 45f4d69
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
9 changes: 3 additions & 6 deletions spank.config.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module.exports = {
depth: 3,
sitemap: [
"/wiki/development",
"/wiki/projects",
"/wiki/release-notes"
]
depth: 5,
inlineDynamicImports: true,
sitemap:["/sitemap"]
}
29 changes: 29 additions & 0 deletions src/routes/sitemap.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script>
import { url, isActive, node as nodeHelper } from '@roxi/routify'
export let node
node = node || $nodeHelper.root
/**
* Basic unstyled navigation. Feel free to style it as you wish.
*
* _node is the current node.
* _node.linkableChildren is the current node's children.
* $url creates an URL from a node path.
* $isActive checks if a node is part of the current URL.
**/
</script>

<ul>
<!-- iterates over each child page -->
{#each node.linkableChildren as childNode}
<!-- if the child is active, adds the isActive class -->
<li class:isActive={$isActive(childNode.path)}>
<a href={$url(childNode.path)}>
<!-- title can be overwritten using `meta.title` -->
{childNode.title}
</a>
{#if childNode.linkableChildren.length > 0}
<svelte:self node={childNode} />
{/if}
</li>
{/each}
</ul>

0 comments on commit 45f4d69

Please sign in to comment.