Skip to content

Commit f0bbdde

Browse files
authored
Upstream blog formatting (#348)
* Upstream blog formatting * More sensical names for blog partials
1 parent 1f93c97 commit f0bbdde

24 files changed

+175
-34
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ resources
55

66
# Auto-generated
77
doc/content/shortcodes.md
8+
public

doc/content/features.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
title: Features
33
---
44

5-
## Partials
5+
## Hugo Layouts
66

7-
The following partials are meant to be overridden:
7+
- `_default/single.html` : Single page layout
8+
- `_default/section.html` : Section layout (a section typically has `_index.md` and contains other pages)
89

9-
- `post_meta.html`: Render meta-data under a post title.
10-
We have not yet defined this template, but you can use it to add author information, date, etc.
11-
- `footer_actions`: This appears in the right-hand side of the footer. E.g., numpy.org uses it for mailing list subscriptions.
10+
Blog post layouts:
11+
12+
- `layouts/partials/posts/post.html`: Blog post layout
13+
- `layouts/partials/posts/list.html`: Blog post listing layout
14+
- `layouts/partials/posts/tag.html`: Tag page layout
1215

1316
## Shortcut list
1417

@@ -146,3 +149,8 @@ graph LR
146149
B --> D{Rhombus}
147150
C --> D
148151
```
152+
153+
## Creating a blog
154+
155+
Pages that are placed under either `content/posts` or `content/blog`
156+
will be formatted as blog posts.

layouts/_default/baseof.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
{{ end }}
1919
{{ end -}}
2020

21-
<!-- Add twitter card for logo and images. You can test here: https://cards-dev.twitter.com/validator -->
21+
<!-- Add twitter card for logo and images. You can preview cards in the X compose window. -->
2222
{{ template "_internal/twitter_cards.html" . }}
23-
2423
</head>
2524
<body>
2625
{{ block "navbar" . }}
@@ -39,7 +38,6 @@
3938
{{ end }}
4039

4140
{{ partial "javascript.html" . -}}
42-
4341
{{ partial "analytics.html" . -}}
4442
</body>
4543
</html>

layouts/_default/section.html

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
11
{{ define "main" }}
2-
{{ partial "section/section.html" . }}
2+
<section class="section content-padding flex-row">
3+
<div class="content-container">
4+
{{ partial "breadcrumbs.html" . }}
5+
<h1>{{ .Title }}</h1>
6+
{{ if .Params.Subtitle }}
7+
<h5 class="subtitle">{{ .Params.Subtitle }}</h5>
8+
{{ end }}
9+
{{ if .Content }}
10+
{{ .Content }}
11+
{{ end }}
12+
{{ if (or (not .Content) .Params.listPages) }}
13+
<div class="page-list">
14+
<ul>
15+
{{ range .Pages }}
16+
{{ if .Title }}
17+
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
18+
{{ end }}
19+
{{ end }}
20+
</ul>
21+
</div>
22+
{{ end }}
23+
</div>
24+
{{ if .Content }}
25+
{{ partial "shortcuts.html" . }}
26+
{{ end }}
27+
</section>
328
{{ end }}

layouts/_default/single.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
{{ define "main" }}
2-
{{ partial "single/single.html" . }}
2+
<section class="article content-padding flex-row">
3+
<div class="content-container">
4+
{{ partial "breadcrumbs.html" . }}
5+
<h1>{{ .Title }}</h1>
6+
{{ if .Params.Subtitle }}
7+
<h5 class="subtitle">{{ .Params.Subtitle }}</h5>
8+
{{ end }}
9+
<div class="article-content">
10+
{{ .Content }}
11+
</div>
12+
</div>
13+
{{ partial "shortcuts.html" . }}
14+
</section>
315
{{ end }}

layouts/_default/term.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ define "main" }}
2+
{{ partial "posts/tag.html" . }}
3+
{{ end }}

layouts/blog/list.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ define "main" }}
2+
{{ partial "posts/list.html" . }}
3+
{{ end }}

layouts/blog/single.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ define "main" }}
2+
{{ partial "posts/post.html" . }}
3+
{{ end }}

layouts/blog/term.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ define "main" }}
2+
{{ partial "posts/tag.html" . }}
3+
{{ end }}

layouts/partials/breadcrumbs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
<li class="breadcrumb-item breadcrumb-home"><a href="{{ .RelPermalink }}"><i class="fas fa-home"></i></a></li>
77
{{ end }}
88
{{- end }}
9-
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
9+
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
1010
</ul>

0 commit comments

Comments
 (0)