Skip to content

Commit 203d493

Browse files
committed
Added a social icons section to the sidebar
[[menu.icons]] can now be used to specify icons that will be displayed after the site's description, but before the main menu items.
1 parent 6458a0b commit 203d493

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,22 @@ This text will appear in a free paragraph below the Title & Description and abov
4949

5050
sidebarFreeText = "A optional paragraph of free text. Set to blank in config.toml to clear..."
5151

52-
You can also include useful menu links by including `"menu=main"` items in your `config.toml`. Example:
52+
You can include clickable icons (e.g. for social networks )by including `"menu=icons"` items in your `config.toml`. Example:
53+
54+
[[menu.icons]]
55+
name = "GitHub"
56+
post = "<img src=\"/images/github.png\""
57+
url = "https://github.com"
58+
59+
You can optionally use the `post` var to include HTML after the `name` in the resulting links.
60+
You can include useful menu links by including `"menu=main"` items in your `config.toml`. Example:
5361

5462
[[menu.main]]
5563
name = "Hugo"
5664
post = "<span class='glyphicon glyphicon-fire'></span>"
5765
url = "http://gohugo.io"
5866

59-
You can optionally use the `pre` and `post` vars to include HTML before or after the `name` in the resulting links.
67+
You can optionally use the `post` var to include HTML after the `name` in the resulting links.
6068

6169
You can use the `"contact_email"` field in `[params]` to set a mailto: link the in the sidebar. Leave blank if you don't want it.
6270

layouts/partials/sidebar-content.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@
1010
</div>
1111
{{ end }}
1212

13+
<ul class="sidebar-menus sidebar-icons">
14+
{{ range .Site.Menus.icons }}
15+
<li><a href="{{.URL}}">{{ .Post }}</a></li>
16+
{{end}}
17+
</ul>
18+
1319
<ul class="sidebar-menus">
14-
{{ range .Site.Menus.main }}
15-
<li>&#187; <a href="{{.URL}}">{{ .Name }}</a> {{ .Post }}</li>
16-
{{end}}
17-
</ul>
20+
{{ range .Site.Menus.main }}
21+
<li>&#187; <a href="{{.URL}}">{{ .Name }}</a>{{ .Post }}</li>
22+
{{end}}
23+
</ul>
1824

1925
<div class="sidebar-recent hidden-xs">
2026
<p>Recent Posts:</p>

static/css/strange-case.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ img {
7676

7777
/* SIDEBAR */
7878

79-
8079
.sidebar {
8180
padding: 2em;
8281
font-size: 1.3em;
@@ -98,6 +97,9 @@ img {
9897
list-style: none;
9998
font-size:1em;
10099
}
100+
.sidebar .sidebar-icons li {
101+
display: inline-block;
102+
}
101103
.sidebar .sidebar-recent {
102104
margin-top: 1.5em;
103105
}

0 commit comments

Comments
 (0)