Skip to content

fix(authors): don't wrap author names in empty-href anchors#3328

Open
Vidminas wants to merge 1 commit into
HugoBlox:mainfrom
Vidminas:fix/author-empty-href
Open

fix(authors): don't wrap author names in empty-href anchors#3328
Vidminas wants to merge 1 commit into
HugoBlox:mainfrom
Vidminas:fix/author-empty-href

Conversation

@Vidminas

Copy link
Copy Markdown

Hi! I've been using HugoBlox (initially Wowchemy) for my personal site for a while. I finally got round to migrating from the old Bootstrap styles to the new Hugo Blox Kit with Tailwind. During the migration, I encountered quite many bugs. Claude makes it fairly easy to go back over git history and pull out generic bug fixes, so this is the first of a bunch of PRs with things I fixed for my site during migration.

πŸš€ What type of change is this?

  • πŸ› Bug fix (A non-breaking change that fixes an issue)
  • ✨ New feature (A non-breaking change that adds functionality)
  • πŸ’… Style change (A change that only affects formatting, visuals, or styling)
  • πŸ“š Documentation update (Changes to documentation only)
  • 🧹 Refactor or chore (A code change that neither fixes a bug nor adds a feature)
  • πŸ’₯ Breaking change (A fix or feature that would cause existing functionality to not work as expected)

🎯 What is the purpose of this change?

In citation/publication author lists, every author name is wrapped in <a href="">, which
browsers resolve to the current page β€” so each author looks like a self-link.

Root cause. page_metadata_authors.html links whenever the author's term-page object
exists ({{ if $termPage }}). But author profile pages ship with build.render: never by
default, so site.GetPage still returns a (truthy) page whose RelPermalink is empty β†’
href="". On Hugo versions that keep a permalink for render-suppressed pages it would instead
link to an unbuilt 404 β€” broken either way.

Fix. Guard the anchor on a non-empty permalink
({{ if and $termPage $termPage.RelPermalink }}); otherwise render the name as plain text (the
existing else branch). A comment explains why.

Verified on the academic-cv starter: href="" occurrences in the built output drop from 3
pages β†’ 0
, and author names render as plain text where their profile pages are unpublished.


πŸ“Έ Screenshots or Screencast (if applicable)

n/a β€” the visible DOM change is <a href="">Jane Doe</a> β†’ Jane Doe.


ℹ️ Documentation Check

  • No, this change does not require a documentation update.
  • Yes, I have updated the documentation accordingly (or will in a follow-up PR).

πŸ“œ Contributor Agreement

Thank you for your contribution!

Author profile pages default to `build.render: never`, so an author's term
page resolves via GetPage but has an empty RelPermalink. The author list
linked whenever the term-page object existed, emitting `<a href="">Name</a>`
β€” a self-link on every author (or a link to an unbuilt 404 on Hugo versions
that keep a permalink for render-suppressed pages).

Only render the anchor when RelPermalink is non-empty; otherwise show the
name as plain text.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Vidminas Vidminas requested a review from gcushen as a code owner July 10, 2026 07:24
@netlify

netlify Bot commented Jul 10, 2026

Copy link
Copy Markdown

βœ… Deploy Preview for academic-demo canceled.

Name Link
πŸ”¨ Latest commit 4ae3f56
πŸ” Latest deploy log https://app.netlify.com/projects/academic-demo/deploys/6a509e46c3b34d0008699f5e

@github-actions

Copy link
Copy Markdown
Contributor

Wow, your first PR! Welcome to the community! πŸŽ‰

Thank you for this contribution to open source and open research. It makes a huge impact for the thousands of innovators building with Hugo Blox.

If you're wondering about next steps, please read our Contributor Guide for coding standards, how to run the project locally, and how to get help.

We hope this is just the start of your journey with us. Let's build the future together! Join us on Discord to connect with the team and community.

Awesome work, we'll take a look soon! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant