new layout

- create baseof
    - separate list, single
    - header, footer
This commit is contained in:
Aditya Telange 2020-07-20 20:32:07 +05:30
parent 2e0ef75edf
commit 8a0783adfb
5 changed files with 56 additions and 50 deletions

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
{{- partial "head.html" . }}
</head>
<body class="{{ if eq .Kind `page` }}single{{ else }}list{{ if .IsHome }} home{{ end }}{{ end }}">
<script>
setTheme();
</script>
<header class="header">
{{- partial "header.html" . }}
</header>
<main class="main">
{{- block "main" . }}
{{end }}
</main>
<footer class="footer">
{{- partial "footer.html" . }}
</footer>
{{ $highlight := resources.Get "highlight.min.js" | minify }}
<script src="{{ $highlight.Permalink }}"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
</body>
</html>

View File

@ -1,4 +1,4 @@
{{- partial "header.html" . }}
{{ define "main" }}
{{- $scope := .Site }}
@ -39,4 +39,4 @@
</footer>
{{- end }}
{{- partial "footer.html" . }}
{{ end }}{{/* end main */}}

View File

@ -1,4 +1,4 @@
{{- partial "header.html" . }}
{{ define "main" }}
<article class="post-single">
<header class="post-header">
@ -26,4 +26,4 @@
{{- end }}
</article>
{{- partial "footer.html" . }}
{{ end }}{{/* end main */}}

View File

@ -1,16 +1,5 @@
</main>
<footer class="footer">
<span>&copy; {{ now.Year }} <a href="{{ "" | absURL }}">{{ .Site.Title }}</a></span>
<span>&middot;</span>
<span>Powered by <a href="https://gohugo.io/" rel="noopener" target="_blank">Hugo</a></span>
<span>&middot;</span>
<span>Theme <a href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank">Paper</a></span>
</footer>
{{ $highlight := resources.Get "highlight.min.js" | minify }}
<script src="{{ $highlight.Permalink }}"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
</body>
</html>
<span>&copy; {{ now.Year }} <a href="{{ "" | absURL }}">{{ .Site.Title }}</a></span>
<span>&middot;</span>
<span>Powered by <a href="https://gohugo.io/" rel="noopener" target="_blank">Hugo</a></span>
<span>&middot;</span>
<span>Theme <a href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank">Paper</a></span>

View File

@ -1,30 +1,16 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
{{- partial "head.html" . }}
</head>
<body class="{{ if eq .Kind `page` }}single{{ else }}list{{ if .IsHome }} home{{ end }}{{ end }}">
<script>
setTheme();
</script>
<header class="header">
<nav class="nav">
{{- if .IsHome }}
<h1 class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></h1>
{{- else }}
<p class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></p>
{{- end }}
{{- if .Site.Menus.main }}
<ul class="menu">
{{- range .Site.Menus.main }}
<li>
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{- end }}
</ul>
{{- end }}
</nav>
</header>
<main class="main">
<nav class="nav">
{{- if .IsHome }}
<h1 class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></h1>
{{- else }}
<p class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></p>
{{- end }}
{{- if .Site.Menus.main }}
<ul class="menu">
{{- range .Site.Menus.main }}
<li>
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{- end }}
</ul>
{{- end }}
</nav>