Skip to content
Permalink
Browse files

Add compact index view

  • Loading branch information...
parsiya committed Nov 23, 2018
1 parent 465cee4 commit dc15df8630c240fb96ac58a510dbfc7bac6619d9
@@ -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).

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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 &rarr;{{ end }}</a>
</footer>
{{ else }}
<p>{{ .Summary }}</p>

{{ if .Truncated }}
<footer>
<a href="{{ .Permalink }}" rel="full-article">{{ with .Site.Params.continueReadingText }}{{ . | markdownify }}{{ else }}Read On &rarr;{{ 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 }}
@@ -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 &rarr;{{ end }}</a>
</footer>
{{ else }}
<p>{{ .Summary }}</p>

{{ if .Truncated }}
<footer>
<a href="{{ .Permalink }}" rel="full-article">{{ with .Site.Params.continueReadingText }}{{ . | markdownify }}{{ else }}Read On &rarr;{{ 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 -->
@@ -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" . }}
@@ -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>
@@ -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

0 comments on commit dc15df8

Please sign in to comment.
You can’t perform that action at this time.