pratik
pratik

The sorting of posts within a day chronologically but sorting days reverse-chronologically on my blog’s homepage is at best 4-5 lines in my previous theme. Yet I’ve been struggling to adapt it to my new Tiny theme.

ChatGPT keeps offering me longer solutions which I rather not do.

|
Embed
jsonbecker
jsonbecker

@pratik should be the exactly same code editing lines 11 and 12 for the grouping and paginating and then keeping everything until line 67, possibly adding some spots where you do date breaks or headers. But should be no different in Tiny than prior theme (it cannot be done in microhooks)

|
Embed
pratik
pratik

@jsonbecker Not done in microhooks? Coz I'm trying to add it in thelayouts/partials/microhook-post-list.html.

So far, I have gotten the part to exclude two categories from my front page to work, like I had in my previous theme and I thought the sorting part would be easier. But I think I'm tripping up where I also want to insert the time the post was made within the day as a permalink and not repeat the date for each post within the same day.

I plan to try again later tonight although doing it just before I sleep is proving to be not such a good idea.

|
Embed
jsonbecker
jsonbecker

@pratik ah I missed a spot. You can do it via that hook, but it will require dumping in basically your whole existing index template from the old theme. A good chunk of it at least.

|
Embed
jsonbecker
jsonbecker

@pratik this sounds a lot what I do which has public code— have you looked at my theme index?

|
Embed
pratik
pratik

@jsonbecker I did it the other way around. Coz Tiny has some code within the index.html whereas, my previous one referenced another template. I'm trying to work within the parameters of Tiny's microhooks design so updating the theme is easier. I was using my old theme code but I'll look at yours too as another solution.

|
Embed
pratik
pratik

@jsonbecker and ha! Just realized my previous theme had the exact same code as yours.

|
Embed
pratik
pratik

@jsonbecker So I ended up with this code for the homepage and finally have no errors in the log but the page is blank. ChatGPT suggested {{ range $paginator.Pages }} instead of {{ range $paginated.PageGroups }} which your theme and my previous theme had but that didn't work either. I think the latter makes more sense but it throws up weird errors. cc: @Mtt

|
Embed
Mtt
Mtt

@pratik Just to make sure I have all the details, can you send me (1) your old code and (2) the code you’ve tried that’s failed.

Also, a quick list of your goals. I know about reverse chronological days, chronological within the day. But it also looks like you’re filtering out categories too? Any detail you can provide and I’ll see why I can do.

|
Embed
pratik
pratik

@Mtt Actually, I just got it to work 🙌🏽 I can send you the code in case you want to document it on the Tiny website for others to use. And yes, I'm also filtering out two categories from the front page. That's done by the first three lines after the two div statements. @jsonbecker

|
Embed
Mtt
Mtt

@pratik Awesome job. And for sure, I’ll document it in full.

|
Embed
pratik
pratik

@Mtt
- Here's the code that worked to order the posts.
- Here is the CSS for the additional two classes I added.

|
Embed
Mtt
Mtt

@pratik I removed the category filtering and did a simple writeup on what you did.

|
Embed
pratik
pratik

@Mtt Awesome. I hope others can do it in less time than I did ☺️ I also liked the alternate styling for each day. Also, feel free to add the category filtering as a separate how-to. The symdiff function was the key. At least one person in that forum thread wanted to implement it for Tiny.

|
Embed
pratik
pratik

@Mtt I want to tinker around category pages on my blog next. For the Movies and TV Books category, I want a bulleted list grouped by month-year displaying only the titles of the posts (don't display posts if there are no titles. For all other categories, I want to display the title and the summary (or micro post) but also grouped by month-year without displaying the date.

I don't see a microhook for the category page, but if there was one, I could tinker around and at least create the latter. I might need a nudge on directing certain categories toward another page template for the former.

|
Embed
Mtt
Mtt

@pratik Ha. Well. Item 2 on my todo list is adding some category page microhooks. I’ll move that up to item 1 and try to make it happen fast.

|
Embed
In reply to
pratik
pratik

@Mtt Thanks. I guess that wait will let me step back from tinkering for now and doing some actual writing on the blog 😊

|
Embed
Mtt
Mtt

@pratik I've added the microhook you should need for your category pages. It is microhook-archive-post-list.html. It works exactly like microhook-post-list.html which you used for your blog page.

|
Embed
pratik
pratik

@Mtt Awesome! Thanks, I'll start tweaking around later this week. I'll look at the documentation, but can we have different templates for different categories or at least 2-3 types?

|
Embed
Mtt
Mtt

@pratik Just saw this reply for some reason, my bad. And yes, you can go crazy similar to how you've done your home page. If this category, do this, else do this and so on and so on. You can even take it a step further and modify things like descriptions (see this question you previously posed).

|
Embed
pratik
pratik

@Mtt Yup. I have that question on the Help forum bookmarked when I work on this. @Moondeer's tips in this thread are also useful. I plan to start simple and then try different templates for different categories.

|
Embed