fix(authors): don't wrap author names in empty-href anchors - #3328
fix(authors): don't wrap author names in empty-href anchors#3328Vidminas 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.
|
|
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 PR is stale because it has not had any recent activity. The resources of the project maintainers are limited, and so we are asking for your help. If you feel that the PR is still relevant in the latest release, consider making the PR easier to review and finding developers to help review the PR. Please be mindful that although we encourage PRs, we cannot expand the scope of the project in every possible direction. There will be requests that don't make the roadmap. This PR will automatically close soon if no further activity occurs. Thank you for your contributions. |
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!