diff options
author | parsiya <parsiya@gmail.com> | 2018-11-23 20:04:38 +0300 |
---|---|---|
committer | parsiya <parsiya@gmail.com> | 2018-11-23 20:04:38 +0300 |
commit | dc15df8630c240fb96ac58a510dbfc7bac6619d9 (patch) | |
tree | e2091dfdc2c2019801308e63d40857003781b76d | |
parent | 465cee42bfb1ac1001a9e1eb89ca75eaaa444458 (diff) |
Add compact index view
-rw-r--r-- | README.md | 18 | ||||
-rwxr-xr-x | images/classicindex.png | bin | 0 -> 413973 bytes | |||
-rwxr-xr-x | images/classicindex_tn.png | bin | 0 -> 153624 bytes | |||
-rwxr-xr-x | images/compactindex.png | bin | 0 -> 230717 bytes | |||
-rwxr-xr-x | images/compactindex_tn.png | bin | 0 -> 172778 bytes | |||
-rw-r--r-- | layouts/index.html | 45 | ||||
-rwxr-xr-x | layouts/partials/classic_index.html | 42 | ||||
-rwxr-xr-x | layouts/partials/compact_index.html | 36 | ||||
-rw-r--r-- | layouts/partials/header.html | 4 | ||||
-rw-r--r-- | sample-config.toml | 3 |
10 files changed, 104 insertions, 44 deletions
@@ -6,7 +6,7 @@ Live demo using the unmodified theme: * [http://hugo-octopress-test.s3-website-us-east-1.amazonaws.com/](http://hugo-octopress-test.s3-website-us-east-1.amazonaws.com/). * Source: [https://github.com/parsiya/Hugo-Octopress-Test](https://github.com/parsiya/Hugo-Octopress-Test). -My personal website runs a modified version (modified index): +My personal website uses the compact index (see below): * [https://parsiya.net](https://parsiya.net). * Source: [https://github.com/parsiya/parsiya.net](https://github.com/parsiya/parsiya.net) @@ -33,6 +33,7 @@ My personal website runs a modified version (modified index): - [Individual pages](#page) - [Disqus](#disqus) - [Twitter Card](#twitter) +- [Compact Index](#index) - [Issues/TODO](#issues) - [Attribution](#attribution) - [Ported by](#portedby) @@ -188,7 +189,7 @@ Search engine customization: ``` ## <a name="sidebarlinks"></a>Sidebar -The sidebar has four section, from top to bottom: +The sidebar has four sections, from top to bottom: * Sidebar header and text (optional). * Social network icons (optional): Icons and links to Github, Bitbucket, and more. @@ -449,6 +450,19 @@ twitterImage: images/02-fuzzer-crash.png The template can be modified at `Hugo-Octopress/partials/custom_twitter_card.html`. +## <a name="index"></a>Compact Index +The original theme renders each post's summary in the main page. I prefer a more compact index and have been using it for my own website for quite a while. You can enable it by adding the following to the config file: + +``` toml +[params] + # Set to true to enable compact index. Set to false or remove to go back to classic view. + compactIndex = true +``` + +Compare the views (classic - compact) - click for full-size image: + +[![classic index](images/classicindex_tn.png)](https://raw.githubusercontent.com/parsiya/Hugo-Octopress/master/images/classicindex.png) [![compact index](images/compactindex_tn.png)](https://raw.githubusercontent.com/parsiya/Hugo-Octopress/master/images/compactindex.png) + ## <a name="issues"></a>Issues/TODO If you discover any issues/bugs or want new features please use the Github issue tracker. Please keep in my mind that development has not been my day job for quite a while and I may be slow in fixing things (don't be surprised if I ask you about details). diff --git a/images/classicindex.png b/images/classicindex.png Binary files differnew file mode 100755 index 0000000..399d66d --- /dev/null +++ b/images/classicindex.png diff --git a/images/classicindex_tn.png b/images/classicindex_tn.png Binary files differnew file mode 100755 index 0000000..0e9e3d8 --- /dev/null +++ b/images/classicindex_tn.png diff --git a/images/compactindex.png b/images/compactindex.png Binary files differnew file mode 100755 index 0000000..fa7af0d --- /dev/null +++ b/images/compactindex.png diff --git a/images/compactindex_tn.png b/images/compactindex_tn.png Binary files differnew file mode 100755 index 0000000..d158f75 --- /dev/null +++ b/images/compactindex_tn.png diff --git a/layouts/index.html b/layouts/index.html index 331398c..4707897 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,42 +1,7 @@ {{ partial "header.html" . }} -<div id="main"> - <div id="content"> - <div class="blog-index"> - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} - {{ range $paginator.Pages }} - <article> - - {{ .Scratch.Set "isHome" true }} - {{ partial "post_header.html" . }} - - {{ if eq .Site.Params.truncate false }} - {{ .Content }} - {{ else if .Description }} - {{ .Description }} - <footer> - <a href="{{ .Permalink }}" rel="full-article">{{ with .Site.Params.continueReadingText }}{{ . | markdownify }}{{ else }}Read On →{{ end }}</a> - </footer> - {{ else }} - <p>{{ .Summary }}</p> - - {{ if .Truncated }} - <footer> - <a href="{{ .Permalink }}" rel="full-article">{{ with .Site.Params.continueReadingText }}{{ . | markdownify }}{{ else }}Read On →{{ end }}</a> - </footer> - {{ end }} - - {{ end }} - - </article> - {{ end }} - <!-- {{ template "_internal/pagination.html" . }} default pagination --> - {{ partial "pagination.html" . }} <!-- use custom pagination --> - - </div> - - {{ partial "sidebar.html" . }} <!-- sidebar --> - </div> -</div> - -{{ partial "footer.html" . }} <!-- footer --> +{{ if .Site.Params.compactIndex }} + {{ partial "compact_index.html" . }} +{{ else }} + {{ partial "classic_index.html" . }} +{{ end }} diff --git a/layouts/partials/classic_index.html b/layouts/partials/classic_index.html new file mode 100755 index 0000000..64b88bb --- /dev/null +++ b/layouts/partials/classic_index.html @@ -0,0 +1,42 @@ +<!-- Partial for classic index page --> + +<div id="main"> + <div id="content"> + <div class="blog-index"> + {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ range $paginator.Pages }} + <article> + + {{ .Scratch.Set "isHome" true }} + {{ partial "post_header.html" . }} + + {{ if eq .Site.Params.truncate false }} + {{ .Content }} + {{ else if .Description }} + {{ .Description }} + <footer> + <a href="{{ .Permalink }}" rel="full-article">{{ with .Site.Params.continueReadingText }}{{ . | markdownify }}{{ else }}Read On →{{ end }}</a> + </footer> + {{ else }} + <p>{{ .Summary }}</p> + + {{ if .Truncated }} + <footer> + <a href="{{ .Permalink }}" rel="full-article">{{ with .Site.Params.continueReadingText }}{{ . | markdownify }}{{ else }}Read On →{{ end }}</a> + </footer> + {{ end }} + + {{ end }} + + </article> + {{ end }} + <!-- {{ template "_internal/pagination.html" . }} default pagination --> + {{ partial "pagination.html" . }} <!-- use custom pagination --> + + </div> + + {{ partial "sidebar.html" . }} <!-- sidebar --> + </div> + </div> + + {{ partial "footer.html" . }} <!-- footer -->
\ No newline at end of file diff --git a/layouts/partials/compact_index.html b/layouts/partials/compact_index.html new file mode 100755 index 0000000..43f70e0 --- /dev/null +++ b/layouts/partials/compact_index.html @@ -0,0 +1,36 @@ +<!-- Partial for compact index --> + +<style> +table.allposts, td.allposts-date, td.allposts-title { + border:none; +} + +td.allposts-date { + padding: 0 0.5em 0 0; +} + +td.allposts-title { + font-size: 110%; +} +</style> + +<div id="main"> + <div id="content"> + <div> + <article role="article"> + <table class="allposts"> + {{ range (where .Site.Pages "Type" "post") }} + {{ if .IsPage }} + <tr> + <td class="allposts-date"><strong>{{ .Date | dateFormat "2006"}} {{ .Date | dateFormat "Jan" }} {{ .Date | dateFormat "2" }}</strong></td> + <td class="allposts-title"><a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a></td> + </tr> + {{ end }} + {{ end }} + </table> + </article> + </div> + {{ partial "sidebar.html" . }} + </div> +</div> +{{ partial "footer.html" . }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 9bd9457..4b89455 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -60,10 +60,10 @@ {{ end }} </head> -<body{{ with .Site.Params.theme }} class="{{ . }}"{{ end }}> +<body> <!-- top header for octopress --> -<header role="banner">{{ partial "octo-header.html" . }}</header> +<header role="banner">{{ partial "octo_header.html" . }}</header> <!-- navigation --> <nav role="navigation">{{ partial "navigation.html" . }}</nav> diff --git a/sample-config.toml b/sample-config.toml index cf76b40..6d45d09 100644 --- a/sample-config.toml +++ b/sample-config.toml @@ -145,6 +145,9 @@ post = "/blog/:year-:month-:day-:title/" # change the post URL to look like the # Don't include the @. # twitterCardAuthor = "CryptoGangsta" + # Set to true to enable compact index. Set to false or remove to go back to classic view. + # compactIndex = true + # Menu # If navigationNewWindow (under [params]) is set to true then all links except root ("/") will open in a new window # If it does not exist or is set to false then links will open in the same window |