Skip to content

Fix footer overlap issue on blog posts with navigation #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

kitbur
Copy link
Contributor

@kitbur kitbur commented Jul 9, 2025

Fixes a bug in which the footer was overlapping with the previous/next post navigation links on posts when only one navigation button was present (e.g., on the most recent post where no "next" button exists).

Changes:

  • Wrapped the entirety of prev-next.html in a container, and added clearfix to the container to properly contain the floated elements.
  • Reduced body margin on blog posts when post navigation is present. The global body's margin-bottom: 170px; was creating excessive space between the navigation and footer on blog posts. A targeted rule reduces this to 80px to maintain consistent spacing while accounting for floated post navigation elements.
  • Increased the space between post content and post navigation for visual consistency.

Copy link

netlify bot commented Jul 9, 2025

Deploy Preview for gokarna-hugo ready!

Name Link
🔨 Latest commit 30f93a6
🔍 Latest deploy log https://app.netlify.com/projects/gokarna-hugo/deploys/686fc25cd1eb170008cb5770
😎 Deploy Preview https://deploy-preview-342--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 project configuration.

@yashmehrotra
Copy link
Collaborator

@526avijitgupta @jamesericdavidson Can you have a look as well ?

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the footer overlapping with single-sided post navigation by containing floated nav links and adjusting spacing.

  • Wraps the existing prev/next links in a .post-navigation container for clearfix
  • Adds CSS to reduce bottom margin when navigation is present and to clear floats
  • Increases vertical padding around the post navigation for consistent spacing

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
layouts/partials/prev-next.html Wrapped existing navigation markup in a <div class="post-navigation">
assets/css/main.css Added body:has(.post-navigation) rule, .post-navigation padding and clearfix

@jamesericdavidson
Copy link
Contributor

jamesericdavidson commented Jul 10, 2025

Thanks, @kitbur! LGTM.

N.B. I've not used prev-next since implementing it, so these changes are much appreciated.


Testing

I tested against exampleSite and the following changes (I wonder if there's a better way to automate this, and/or stage with Netlify?):

  1. Add config key to hugo.toml:
[params]
  togglePreviousAndNextButtons = true
  1. Remove weight param from exampleSite/content/posts/*.md:
cd exampleSite/content/posts/
sed -i '/weight: /d' *.md

Screenshots

@526avijitgupta @yashmehrotra

Screenshot examples of this PR:

Emoji Support

image

Theme Documentation - Advanced

image

Copy link
Member

@526avijitgupta 526avijitgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kitbur thanks for the fix!
I've left one nit comment. Could you please also apply the copilot suggestions?

Comment on lines 652 to 654
content: "";
display: table;
clear: both;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's order alphabetically

  clear: both;
  content: "";
  display: table;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

30f93a6

No problem; I'm happy to help!

@kitbur
Copy link
Contributor Author

kitbur commented Jul 10, 2025

Thanks for the review! I think I got everything. Let me know if you'd like any more changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants