Creating a blog posts page apart from default?

I tried to find this in the archive but maybe I’m not describing it properly. Thanks to @lmika’s awesome new sidebar-on-every-page option with the Sidebar plug-in for Tiny Theme, I’d like to recreate my old blog style, which had a default front page with an intro/welcome, and then a Blog tab up top that went to a page of posts. I started with adding back the Custom Home Page plugin, and the new Sidebar works great with that. Yay!

Next is a “Blog” page. I want a “Blog” tab at the top that when clicked, shows my posts. I know how to create a page of posts for a single category - to do that, I create a redirect to a category.

This doesn’t work if I just redirect to my main blog feed. Is there a way to redirect to an “all” category?

I tried redirecting to:

https://eilloh.net/categories/

But that doesn’t seem to work.

I also tried:

https://eilloh.net/feed.xml

But that just went to the raw feed file. (So did the JSON version)

Thoughts?

(I thought about creating an ALL category, but I can’t bulk-assign a category to all my past posts either on Micro.blog or using Mars Edit…)

1 Like

I did something similar with an all posts category. And you can have Micro.blog run the filter retrospectively when you set it up to capture new posts into your All Posts category :slight_smile:

1 Like

You can make a custom page layout on layout/thing/single.html and then a blank page at content/thing.md that has Title as Thing and type as Thing in the front matter and is otherwise blank.

Then build a blog list page how you would on your index page.

No category or category filtering needed.

2 Likes

So I tried this last night, and it didn’t seem to work, so I left it until this morning (because maybe the servers were just being a bit slow), and this morning it doesn’t seem to work, either? I created https://eilloh.net/categories/allposts/ and it isn’t showing me anything. Maybe I did it wrong? I’ll try again!

Edit: Okay, I deleted it so I could try it again, and now it’s not letting me recreate it. :confused:

1 Like

I SO appreciate the response, but I don’t know enough to implement this - I don’t know Go or Hugo well enough to follow these directions.

Specifically - I don’t see a page called layout/thing/single.html and I don’t know how I’d create one, and or how to build a blog list page - those are all things that would require Hugo code, right? Because if I create a new template, which is what you’re asking (I assume?), it just gives me a blank page. I don’t know Hugo, I don’t know what code to write in.

Here’s an example. My Archive page is custom. I create a new layout in the design that I name layouts/archive/single.html and the content of that template is as follows:

{{ define "main" }}
 <div class="content list h-feed singlearea">
{{$pages := where .Site.Pages "Type" "post" }}
  {{ range $pages.GroupByDate "2006" }}
    <div class="year">
      <h2>
        {{ .Key }}
      </h2>
      {{ range .Pages.GroupByDate "January" }}
        <div class="month">
        <h3>
          {{ .Key }}
        </h3>
        <div class="post-list">
          {{ range .Pages }}
            {{ partial "li.html" . }}
          {{ end }}
        </div>
        </div>
      {{ end }}
    </div>
  {{ end }}
{{ end }}

Now that’s specific to how I want my archive page to look-- I suspect you just want to paste what’s already in your template for layouts/index.html before the custom home page into this file.

Then, create a new file called content/archive.md (in my case-- you can replace the word “archive” in the prior file name and change this file name to match to whatever you want it to be).

That page just has this:

---
title: Archive
type: archive
---

And nothing else. That says “Make a page at $MYURL/archive that uses the template found in layouts/archive/single.html”.

Then just add the link to that page where you want it on your base_of template or wherever you navigation is hiding.

By the time you’re customizing at this level, it’d be a big help to learn the basics of Hugo :).

1 Like

I’m so sorry I haven’t tested this yet, I’ve been really busy, but wanted to say thank you for posting this and I really appreciate that help! I’m going to work on it this weekend.