Преглед на файлове

Make use of the base template

digitalcraftsman преди 7 години
родител
ревизия
82832c1244
променени са 5 файла, в които са добавени 42 реда и са изтрити 69 реда
  1. 4
    12
      layouts/404.html
  2. 8
    0
      layouts/_default/baseof.html
  3. 9
    16
      layouts/_default/list.html
  4. 11
    18
      layouts/_default/single.html
  5. 10
    23
      layouts/index.html

+ 4
- 12
layouts/404.html Целия файл

@@ -1,12 +1,4 @@
1
-{{ partial "head.html" . }}
2
-<body class="{{ .Site.Params.themeColor }}">
3
-
4
-{{ partial "sidebar.html" . }}
5
-
6
-    <div class="content container">
7
-      <h1>404: Page not found</h1>
8
-        <p class="lead">Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. <a href="{{ .Site.BaseURL }}">Head back home</a> to try finding it again.</p>
9
-    </div>
10
-
11
-  </body>
12
-</html>
1
+{{ define "main" -}}
2
+<h1>404: Page not found</h1>
3
+<p class="lead">Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. <a href="{{ .Site.BaseURL }}">Head back home</a> to try finding it again.</p>
4
+{{- end }}

+ 8
- 0
layouts/_default/baseof.html Целия файл

@@ -0,0 +1,8 @@
1
+{{ partial "head.html" . }}
2
+  <body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}">
3
+  {{ partial "sidebar.html" . }}
4
+    <div class="content container">
5
+    {{ block "main" . -}}{{- end }}
6
+    </div>
7
+  </body>
8
+</html>

+ 9
- 16
layouts/_default/list.html Целия файл

@@ -1,16 +1,9 @@
1
-{{ partial "head.html" . }}
2
-<body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}">
3
-
4
-  {{ partial "sidebar.html" . }}
5
-
6
-  <div class="content container">
7
-    <ul class="posts">
8
-      {{ range .Data.Pages }}
9
-      <li>
10
-        <span><a href="{{ .Permalink }}">{{ .Title }}</a> <time class="pull-right post-list">{{ .Date.Format "Mon, Jan 2, 2006" }}</time></span>
11
-      </li>
12
-      {{ end }}
13
-    </ul>
14
-  </div>
15
-</body>
16
-</html>
1
+{{ define "main" -}}
2
+<ul class="posts">
3
+{{ range .Data.Pages -}}
4
+  <li>
5
+    <span><a href="{{ .Permalink }}">{{ .Title }}</a> <time class="pull-right post-list">{{ .Date.Format "Mon, Jan 2, 2006" }}</time></span>
6
+  </li>
7
+{{- end }}
8
+</ul>
9
+{{- end }}

+ 11
- 18
layouts/_default/single.html Целия файл

@@ -1,19 +1,12 @@
1
-{{ partial "head.html" . }}
2
-<body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}">
3
-  {{ partial "sidebar.html" . }}
1
+{{ define "main" -}}
2
+<div class="post">
3
+  <h1>{{ .Title }}</h1>
4
+  <span class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</span>
5
+  {{ .Content }}
6
+</div>
4 7
 
5
-  <div class="content container">
6
-    <div class="post">
7
-      <h1>{{ .Title }}</h1>
8
-      <span class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</span>
9
-      {{ .Content }}
10
-    </div>
11
-
12
-			{{ if .Site.Params.disqusShortname }}
13
-				<h2>Comments</h2>
14
-				{{ partial "disqus" . }}
15
-			{{ end }}
16
-		</div>
17
-
18
-</body>
19
-</html>
8
+{{ if .Site.Params.disqusShortname -}}
9
+<h2>Comments</h2>
10
+{{ partial "disqus" . }}
11
+{{- end }}
12
+{{- end }}

+ 10
- 23
layouts/index.html Целия файл

@@ -1,26 +1,13 @@
1
-{{ partial "head.html" . }}
2
-<body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}">
3
-
4
-{{ partial "sidebar.html" . }}
5
-
6
-    <div class="content container">
1
+{{ define "main" -}}
7 2
 <div class="posts">
8
-
9
-      {{ range .Data.Pages }}
10
-  <div class="post">
11
-    <h1 class="post-title">
12
-      <a href="{{ .Permalink }}">
13
-        {{ .Title }}
14
-      </a>
15
-    </h1>
16
-
17
-    <span class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</span>
18
-
19
-    {{ .Content }}
20
-  </div>
21
-  {{ end }}
3
+{{ range .Data.Pages -}}
4
+<div class="post">
5
+  <h1 class="post-title">
6
+    <a href="{{ .Permalink }}">{{ .Title }}</a>
7
+  </h1>
8
+  <span class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</span>
9
+  {{ .Content }}
22 10
 </div>
11
+{{- end }}
23 12
 </div>
24
-
25
-  </body>
26
-</html>
13
+{{- end }}