diff options
| author | Camil Staps | 2021-06-23 09:25:36 +0200 | 
|---|---|---|
| committer | Camil Staps | 2021-06-23 09:25:36 +0200 | 
| commit | 9b8045e9ff6fc02dde1f0e14ecb419d852352633 (patch) | |
| tree | fd0a206697ca520079f7737f9f669c80787ffc35 /resources/pug/include | |
| parent | Replace menuItem mixin in sidebar layout with single menu mixin (diff) | |
Setup infrastructure for articles written in markdown
Diffstat (limited to 'resources/pug/include')
| -rw-r--r-- | resources/pug/include/layout-articles.pug | 8 | ||||
| -rw-r--r-- | resources/pug/include/layout-sidebar.pug | 7 | 
2 files changed, 14 insertions, 1 deletions
| diff --git a/resources/pug/include/layout-articles.pug b/resources/pug/include/layout-articles.pug new file mode 100644 index 0000000..88b1aea --- /dev/null +++ b/resources/pug/include/layout-articles.pug @@ -0,0 +1,8 @@ +extends layout-sidebar.pug + +block append menu +	- var base_url = '/articles/' +	+menu( +		{name: 'Home', link: ''}, +		{name: 'Clean Sandbox', year: 2021, month: 6, day: 22}, +	) diff --git a/resources/pug/include/layout-sidebar.pug b/resources/pug/include/layout-sidebar.pug index 68c1ac2..8cf7d5a 100644 --- a/resources/pug/include/layout-sidebar.pug +++ b/resources/pug/include/layout-sidebar.pug @@ -6,10 +6,15 @@ block content  			ul.nav.nav-pills.nav-stacked  				block menu  					mixin menu(...items) +						- const pad_zero = n => n < 10 ? '0' + n : n; +  						each item in items  							if typeof item.link == 'undefined'  								- item.link = item.name.toLowerCase().replace(/\W/g, '-') +							unless typeof item.year == 'undefined' || typeof item.month == 'undefined' || typeof item.day == 'undefined' +								- item.link = item.year + '-' + pad_zero(item.month) + '-' + pad_zero(item.day) + '-' + item.link +  							li(role='presentation', class=(page == item.link) ? 'active' : '')  								a(href=base_url + (item.link == '' ? '' : item.link + '.html'))= item.name @@ -22,5 +27,5 @@ block content  		div.col-lg-2.col-md-2.text-right  			block subtitle-right -		div.col-lg-9.col-md-8.text-justify +		div.col-lg-9.col-md-8.text-justify.markdown  			block page | 
