diff options
author | parsiya@gmail.com <parsiya@gmail.com> | 2016-07-31 21:50:33 +0300 |
---|---|---|
committer | parsiya@gmail.com <parsiya@gmail.com> | 2016-07-31 21:50:33 +0300 |
commit | 16e73c1fde2317bebfb93b5942b572db4d5831e6 (patch) | |
tree | 6a665ed7541ebbad77b1d98e7955e1436301cc06 | |
parent | a700f9a0cbb002abf0403700412eda26094aaed4 (diff) |
Add control to make sidebar menu links open in a new window
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | layouts/partials/sidebar.html | 5 |
2 files changed, 5 insertions, 2 deletions
@@ -254,6 +254,8 @@ This menu can be enabled by setting the `sidebar_menu_enabled` to `true` in conf URL = "/categories/hugo/" weight = 1 + * If the `sidebarNewWindow` parameter in config file to `true` to open the sidebar links in a new window. If this parameter does not exist or set to `false` then links open in the same window (default behavior). + ### <a name="sidebarrecent"></a>Recent posts Last x recent posts can be displayed in the sidebar. This number can be set in the config file using the `sidebarRecentLimit`. To hide this section either remove `sidebarRecentLimit` from the config file or set it to zero. diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 739d365..dd218af 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -39,7 +39,8 @@ </ul> <!-- sidebar menu - items are read from the config file - first we check if it is enabled in config file and then start adding the items --> + first we check if it is enabled in config file and then start adding the items + if Site.Params.sidebarNewWindow exists and is set to true then open these links in a new window --> {{ if eq .Site.Params.sidebar_menu_enabled true }} <section class="odd"> @@ -48,7 +49,7 @@ {{ end }} {{ range .Site.Menus.sidebar }} <li> - <a href="{{ .URL | absURL }}" title="{{ .Name }}">{{ .Name }}</a> + <a href="{{ .URL | absURL }}" title="{{ .Name }}" {{ if eq $.Site.Params.sidebarNewWindow true }} target="_blank" {{ end }}>{{ .Name }}</a> </li> {{ end }} </section> |