Added the option to show the sidebar on other pages (#2)
Added settings to show the sidebar on posts and other pages, in addition to the home page.
This commit is contained in:
		
							parent
							
								
									d70e270ed0
								
							
						
					
					
						commit
						8a80ab665d
					
				|  | @ -1,4 +1,8 @@ | ||||||
| {{ if .IsHome -}} | {{ $isPost := eq .Page.Type "post" -}} | ||||||
|  | {{ $showOnPosts := $.Site.Params.sidebar_show_on_posts -}} | ||||||
|  | {{ $showOnPages := $.Site.Params.sidebar_show_on_pages -}} | ||||||
|  | {{ $shouldShowSidebar := or .IsHome (and $showOnPosts $isPost) (and $showOnPages (not $isPost)) -}} | ||||||
|  | {{ if $shouldShowSidebar -}} | ||||||
| <div class="sidebar"> | <div class="sidebar"> | ||||||
|     {{ if templates.Exists "partials/sidebar.html" }} |     {{ if templates.Exists "partials/sidebar.html" }} | ||||||
|     {{ partial "sidebar.html" . }} |     {{ partial "sidebar.html" . }} | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								plugin.json
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								plugin.json
									
									
									
									
									
								
							|  | @ -1,8 +1,20 @@ | ||||||
| { | { | ||||||
|     "version": "1.1.1", |     "version": "1.2.0", | ||||||
|     "title": "Sidebar for Tiny Theme", |     "title": "Sidebar for Tiny Theme", | ||||||
|     "description": "Adds a sidebar to a blog using Tiny Theme", |     "description": "Adds a sidebar to a blog using Tiny Theme", | ||||||
|     "includes": [ |     "includes": [ | ||||||
|         "/sidebar.css" |         "/sidebar.css" | ||||||
|  |     ], | ||||||
|  |     "fields": [ | ||||||
|  |         { | ||||||
|  |             "field": "params.sidebar_show_on_posts", | ||||||
|  |             "label": "Show sidebar on posts", | ||||||
|  |             "type": "boolean" | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             "field": "params.sidebar_show_on_pages", | ||||||
|  |             "label": "Show sidebar on other pages", | ||||||
|  |             "type": "boolean" | ||||||
|  |         } | ||||||
|     ] |     ] | ||||||
| } | } | ||||||
		Loading…
	
		Reference in a new issue