{{define "base"}}<!DOCTYPE HTML>
<html>
	<head>
		{{ template "head" . }}
		<link rel="stylesheet" type="text/css" href="{{.Host}}/css/{{.Theme}}.css" />
		<link rel="shortcut icon" href="{{.Host}}/favicon.ico" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<meta name="application-name" content="{{.SiteName}}">
		<meta name="application-url" content="{{.Host}}">
		<meta property="og:site_name" content="{{.SiteName}}" />
	</head>
	<body {{template "body-attrs" .}}>
		<div id="overlay"></div>
		<header>
			{{ if .Chorus }}<nav id="full-nav">
				<div class="left-side">
					<h2><a href="/">{{.SiteName}}</a></h2>
				</div>
			{{ else }}
				<h2><a href="/">{{.SiteName}}</a></h2>
			{{ end }}
			{{if not .SingleUser}}
			<nav id="user-nav">
				{{if .Username}}
				<nav class="dropdown-nav">
					<ul><li><a>{{.Username}}</a> <img class="ic-18dp" src="/img/ic_down_arrow_dark@2x.png" /><ul>
							{{if .IsAdmin}}<li><a href="/admin">Admin dashboard</a></li>{{end}}
							<li><a href="/me/settings">Account settings</a></li>
							<li><a href="/me/export">Export</a></li>
							{{if .CanInvite}}<li><a href="/me/invites">Invite people</a></li>{{end}}
							<li class="separator"><hr /></li>
							<li><a href="/me/logout">Log out</a></li>
						</ul></li>
					</ul>
				</nav>
				{{end}}
				<nav class="tabs">
					{{ if and .SimpleNav (not .SingleUser) }}
					{{if and (and .LocalTimeline .CanViewReader) .Chorus}}<a href="/"{{if eq .Path "/"}} class="selected"{{end}}>Home</a>{{end}}
					{{ end }}
					{{if or .Chorus (not .Username)}}<a href="/about"{{if eq .Path "/about"}} class="selected"{{end}}>About</a>{{end}}
					{{ if not .SingleUser }}
						{{ if .Username }}
					{{if or (not .Chorus) (gt .MaxBlogs 1)}}<a href="/me/c/"{{if eq .Path "/me/c/"}} class="selected"{{end}}>Blogs</a>{{end}}
					{{if and (and .Chorus (eq .MaxBlogs 1)) .Username}}<a href="/{{.Username}}/"{{if eq .Path (printf "/%s/" .Username)}} class="selected"{{end}}>My Posts</a>{{end}}
					{{if not .DisableDrafts}}<a href="/me/posts/"{{if eq .Path "/me/posts/"}} class="selected"{{end}}>Drafts</a>{{end}}
						{{ end }}
					{{if and (and  .LocalTimeline .CanViewReader) (not .Chorus)}}<a href="/read"{{if eq .Path "/read"}} class="selected"{{end}}>Reader</a>{{end}}
					{{if and (and (and  .Chorus .OpenRegistration) (not .Username)) (or (not .Private) (ne .Landing ""))}}<a href="/signup"{{if eq .Path "/signup"}} class="selected"{{end}}>Sign up</a>{{end}}
					{{if not .Username}}<a href="/login"{{if eq .Path "/login"}} class="selected"{{end}}>Log in</a>{{else if .SimpleNav}}<a href="/me/logout">Log out</a>{{end}}
					{{ end }}
				</nav>
				{{if .Chorus}}{{if .Username}}<div class="right-side" style="font-size: 0.86em;">
							<a class="simple-btn" href="/new">New Post</a>
						</div>{{end}}
					</nav>
				{{end}}
			</nav>
			{{end}}
		</header>

		<div id="official-writing">
			{{ template "content" . }}
		</div>

		{{ template "footer" . }}
		
		{{if not .JSDisabled}}
		<script type="text/javascript">
		{{if .WebFonts}}
		try { // Google Fonts
		  WebFontConfig = {
			custom: { families: [ 'Lora:400,700:latin', 'Open+Sans:400,700:latin' ], urls: [ '/css/fonts.css' ] }
		  };
		  (function() {
			var wf = document.createElement('script');
			wf.src = '/js/webfont.js';
			wf.type = 'text/javascript';
			wf.async = 'true';
			var s = document.getElementsByTagName('script')[0];
			s.parentNode.insertBefore(wf, s);
			})();
		} catch (e) { /* ¯\_(ツ)_/¯ */ }
		{{end}}
		</script>
		{{else}}
			{{if .WebFonts}}<link href="{{.Host}}/css/fonts.css" rel="stylesheet" type="text/css" />{{end}}
		{{end}}
	</body>
</html>{{end}}
{{define "body-attrs"}}{{end}}
