appernetic / hugo-nederburg-theme

Nederburg is a fast and secure hugo theme and is a port of the Tracks WP theme
Other
106 stars 86 forks source link

Remove date from "About" etc? Limit "preview" text for posts on home page #46

Open jslingsby opened 5 years ago

jslingsby commented 5 years ago

Thanks for a great theme!!!

These are more questions than issues, so apologies in advance. 1) I have a date popping up at the top of the "About" and other pages I've set to navigate in the sidebar. This is useful for blog posts, but not for "About" and other pages with relatively static content. If I remove the date from the index.md it just displays 01 January. How can I remove it?

2) Where does one set the limit on the length of preview text shown for each post on the home page?

Thanks!!!

jslingsby commented 5 years ago

For demonstration I've launched a page at http://www.ecologi.st/. This has raised a couple of other issues:

  1. Related to the date issue above - the "About" etc pages are rendered with tags and categories on the side too. This likely because are rendered as blog posts? How can one fix this?

  2. The Disqus app is squashed into a very thin box somehow...

I'm no CSS or Hugo expert, but I'll report back if I find fixes myself.

Thanks!!!

Pinaute commented 5 years ago

Hi @jslingsby

I have a date popping up at the top of the "About" and other pages I've set to navigate in the sidebar. This is useful for blog posts, but not for "About" and other pages with relatively static content. If I remove the date from the index.md it just displays 01 January. How can I remove it?

I have the same issue. I edited the file hugo-nederburg-theme/layouts/_default/single.html Added {{ if not .Date.IsZero }} ... {{ end }} around the class "date" As below

{{ if not .Date.IsZero }}
    <span class="date">{{ .Date.Format "02 January 2006" }}</span>  <span> / </span>
{{ end }}

Related to the date issue above - the "About" etc pages are rendered with tags and categories on the side too. This likely because are rendered as blog posts? How can one fix this?

Indeed the page "About", etc. uses the same template as blog posts.

Always in the same file hugo-nederburg-theme/layouts/_default/single.html.
Add the following condition to display comments only if they are defined{{ if ( .Params.categories ) and ( .Params.categories "!=" "") }} ... {{ end }} and the same thing for tags {{ if ( .Params.tags ) and ( .Params.tags "!=" "") }} ... {{ end }}

This should look like:

  {{ if ( .Params.categories ) and ( .Params.categories "!=" "") }}
  <div class="entry-categories"><p><span>Categories</span>
    {{ range $index, $name := .Params.categories }}
    <a href="{{ "/categories/" | relLangURL }}{{ $name | urlize }}" title="View all posts in {{ $name }}">{{ $name }}</a>{{ end }}
  </p>
</div>
{{ end }}

{{ if ( .Params.tags ) and ( .Params.tags "!=" "") }}
<div class="entry-tags"><p><span>Tags</span>
  {{ range $index, $name := .Params.tags }}
  <a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}" title="View all posts tagged {{ $name }}">{{ $name }}</a>
  {{ end }}

</p></div>  {{ end }} </div>

I don't know if it's a good thing to do, there may be edge effects. Anyway, it works for me :-)

jslingsby commented 5 years ago

Brilliant, seems to work perfectly! Thanks!

appernetic commented 5 years ago

I think the best soluton is to do a separate template for About, similar to the one for contact.

MatthewMcD commented 5 years ago

Based on feedback from Discourse I reviewed this with the current build of the theme and example site. I have what I think is a good resolution that makes it a lot cleaner and there are no code changes required to the page. This just forces Hugo to build the pages correctly.

I don't want to overwhelm you with PRs, so I'll submit this one after you decide on my previous PRs.

appernetic commented 5 years ago

@MatthewMcD I have done a sprint on this theme now. You can submit the PR!

MatthewMcD commented 5 years ago

Great, I'll pull and rebuild then submit the PR.