Skip to content

Commit

Permalink
feat: Added navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
holmey committed Apr 1, 2023
1 parent b5a0374 commit a677c05
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"getkirby/staticache": "^1.0",
"wearejust/kirby-twig": "^5.0",
"distantnative/retour-for-kirby": "^4.4",
"diesdasdigital/kirby-meta-knight": "^1.2"
"diesdasdigital/kirby-meta-knight": "^1.2",
"belugadigital/kirby-navigation": "^3.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
47 changes: 46 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions site/blueprints/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ tabs:
templates: article
sortable: false
max: 20
navigation:
icon: folder-structure
fields:
navigation:
label: Navigation
type: navigation
levels: 3
width: 2/3

globals:
icon: globe
seotab:
Expand Down
28 changes: 27 additions & 1 deletion site/snippets/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,30 @@
<meta name="msapplication-TileColor" content="#000000"/>
<meta name="theme-color" content="#000000"/>
</head>
<body>
<body>
<header>
<nav>
<?php if($site->navigation()->isNotEmpty()): ?>
<ul>
<?php foreach($site->navigation()->toStructure() as $nav): ?>
<li>
<a href="<?php echo $nav->url(); ?>" <?php e($nav->isOpen(), 'aria-current') ?>>
<?php echo $nav->text() ?>
</a>
<?php if($nav->children()->isNotEmpty()): ?>
<ul>
<?php foreach($nav->children()->toStructure() as $child): ?>
<li>
<a href="<?php echo $child->url() ?>">
<?php echo $child->text() ?>
</a>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</nav>
</header>

0 comments on commit a677c05

Please sign in to comment.