Move nav links into settings

This commit is contained in:
Oliver Davies 2018-05-15 02:18:37 +01:00
parent dd137e9018
commit 0d87c3b806
3 changed files with 28 additions and 10 deletions

View file

@ -241,3 +241,6 @@ events:
name: 'unified.diff' name: 'unified.diff'
location: Cardiff, UK location: Cardiff, UK
website: http://unifieddiff.co.uk website: http://unifieddiff.co.uk
imports:
- '../../data/navigation.yml'

24
data/navigation.yml Normal file
View file

@ -0,0 +1,24 @@
navigation:
- title: About
href: '/'
pattern: '^/.$'
- title: Experience
href: '/experience'
pattern: '^/experience/?$'
- title: Talks
href: '/talks'
pattern: '^/talks/?'
- title: 'Open Source'
href: '/opensource'
pattern: '^/opensource/?$'
- title: Blog
href: '/blog'
pattern: '^/blog/?'
- title: Contact
href: '/contact'
pattern: '^/contact/?'

View file

@ -15,17 +15,8 @@
</div> </div>
</div> </div>
{% set links = [
{ title: 'About', href: '/', pattern: '^/.$' },
{ title: 'Experience', href: '/experience', pattern: '^/experience/?$' },
{ title: 'Talks', href: '/talks', pattern: '^/talks/?' },
{ title: 'Open Source', href: '/opensource', pattern: '^/opensource/?$' },
{ title: 'Blog', href: '/blog', pattern: '^/blog/?' },
{ title: 'Contact', href: '/contact', pattern: '^/contact/?' }
] %}
<nav class="hidden w-full md:w-2/3 lg:w-3/4 sm:flex sm:flex-wrap sm:justify-end" role="navigation"> <nav class="hidden w-full md:w-2/3 lg:w-3/4 sm:flex sm:flex-wrap sm:justify-end" role="navigation">
{% for link in links %} {% for link in site.navigation %}
<a href="{{ link.href }}" class="flex items-center -mx-4 p-4 sm:border-b-3 sm:border-transparent sm:ml-4 sm:mr-0 sm:p-0 {{ loop.first ? 'border-t border-grey-lighter sm:border-t-0 sm:border-transparent' }} {{ page.url matches '#' ~ link.pattern ~ '#' ? 'sm:bg-transparent sm:border-blue' }}"> <a href="{{ link.href }}" class="flex items-center -mx-4 p-4 sm:border-b-3 sm:border-transparent sm:ml-4 sm:mr-0 sm:p-0 {{ loop.first ? 'border-t border-grey-lighter sm:border-t-0 sm:border-transparent' }} {{ page.url matches '#' ~ link.pattern ~ '#' ? 'sm:bg-transparent sm:border-blue' }}">
{{ link.title }} {{ link.title }}
</a> </a>