gokarna-theme / gokarna-hugo

A minimal opinionated theme for Hugo
https://gokarna-hugo.netlify.app
GNU General Public License v3.0
358 stars 140 forks source link

Add Previous and Next buttons #124

Closed jamesericdavidson closed 1 year ago

jamesericdavidson commented 2 years ago

Screenshots

exampleSite

Screenshot 2022-09-12 at 16-02-08 Theme Documentation - Basics

jamesdavidson.xyz

image

Default sort problem

Sadly, works poorly with .Weight due to Hugo's default sort, which prefers .Weight over .Date:

This workaround does not seem to work either: https://www.feliciano.tech/blog/custom-sort-hugo-single-pages/

Feedback

If you think this is worth adding, I can look into using .Date instead of Hugo's default sort.

I'd also appreciate feedback on the CSS, as I'm no designer.

netlify[bot] commented 2 years ago

Deploy Preview for gokarna-hugo ready!

Name Link
Latest commit 7f70241f0e94171946826d39894a9f1995d01aea
Latest deploy log https://app.netlify.com/sites/gokarna-hugo/deploys/635aa87ec6830f00089042bb
Deploy Preview https://deploy-preview-124--gokarna-hugo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

jamesericdavidson commented 2 years ago

Fixed an odd bug with <hr> in f591630ce4fd74e0ddd272f02a20f1de137b1d01.

dchiquito commented 2 years ago

I just built my own slightly uglier version of this, I think it's a great idea!

It might be wise to add a configuration option to toggle it on/off, similarly to how showPostsOnHomePage controls whether or not posts are shown on the home page. The theme is so minimal that having this on by default is probably visual clutter for the average user.

yashmehrotra commented 2 years ago

@jamesericdavidson Thanks for the PR and sorry for the late reply.

Can you hide this feature behind a config parameter and add documentation to enable it ?

526avijitgupta commented 2 years ago

@jamesericdavidson Thanks for submitting the PR. I just have one small suggestion from the CSS side - let's make the whole text including the arrow and the word "Previous"/"Next" as a hyperlink to make it easier for the user. Something like:

Screenshot 2022-10-05 at 11 26 18
526avijitgupta commented 2 years ago

@jamesericdavidson Any updates on this :) ?

jamesericdavidson commented 2 years ago

The expanded hyperlinks, toggle and documentation are in.

The implementation is still naive thanks to default sort, which I'm less than thrilled by. But it works if you are willing to forego .Weight.

526avijitgupta commented 2 years ago

@jamesericdavidson Thanks for implementing the updates!

Just one more thing - can you please add a screenshot to this PR for review of how the prev/next buttons look like? C

But it works if you are willing to forego .Weight.

Works for me. We can try to add it later. @yashmehrotra thoughts?

jamesericdavidson commented 1 year ago

can you please add a screenshot to this PR for review of how the prev/next buttons look like?

With .Weight removed from post YAML:

sed -i 's/weight: .*//' exampleSite/content/posts/*

And togglePreviousAndNextButtons = "true" set in exampleSite/config.toml:

image

If you want exampleSite to appear this way, I can add the commit to this PR.

jamesericdavidson commented 1 year ago

@yashmehrotra @526avijitgupta Happy to merge? :slightly_smiling_face:

526avijitgupta commented 1 year ago

LGTM. @yashmehrotra ?

526avijitgupta commented 1 year ago

ping @yashmehrotra - Let's merge?

yashmehrotra commented 1 year ago

Thanks for the PR @jamesericdavidson

Sorry for the delayed response