fix(authors): don't wrap author names in empty-href anchors#3328
Open
Vidminas wants to merge 1 commit into
Open
fix(authors): don't wrap author names in empty-href anchors#3328Vidminas wants to merge 1 commit into
Vidminas wants to merge 1 commit into
Conversation
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>
β Deploy Preview for academic-demo canceled.
|
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! β¨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?
π― What is the purpose of this change?
In citation/publication author lists, every author name is wrapped in
<a href="">, whichbrowsers resolve to the current page β so each author looks like a self-link.
Root cause.
page_metadata_authors.htmllinks whenever the author's term-page objectexists (
{{ if $termPage }}). But author profile pages ship withbuild.render: neverbydefault, so
site.GetPagestill returns a (truthy) page whoseRelPermalinkis empty βhref="". On Hugo versions that keep a permalink for render-suppressed pages it would insteadlink 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 (theexisting
elsebranch). A comment explains why.Verified on the
academic-cvstarter:href=""occurrences in the built output drop from 3pages β 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
π Contributor Agreement
Thank you for your contribution!