Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix template lookup to prefer first suffix when media type has multiple suffixes#14601

Closed
04cb wants to merge 1 commit into
gohugoio:masterfrom
04cb:master
Closed

Fix template lookup to prefer first suffix when media type has multiple suffixes#14601
04cb wants to merge 1 commit into
gohugoio:masterfrom
04cb:master

Conversation

@04cb
Copy link
Copy Markdown

@04cb 04cb commented Mar 8, 2026

Fixes #13877. When a media type has multiple suffixes defined (e.g. ['b','a','d','c']), only the first suffix should be considered for template lookup as documented.

Previously, the template selection would incorrectly use the last (alphabetically sorted) suffix instead of the first. This fix:

  1. Adds a Suffix field to TemplateDescriptor to track the specific suffix used in the template filename
  2. Sets the Suffix field when creating template descriptors
  3. Updates the template comparison logic to prefer templates whose suffix matches the media type's FirstSuffix

This ensures that templates like page.html.b are preferred over page.html.d when 'b' is the first suffix defined for the media type.

…le suffixes

Fixes #13877. When a media type has multiple suffixes defined,
only the first suffix should be considered for template lookup.
This adds a Suffix field to TemplateDescriptor and uses it
during template comparison to prefer templates matching the
media type's FirstSuffix.
@gemini-code-assist
Copy link
Copy Markdown

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 8, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

bep added a commit to bep/hugo that referenced this pull request Mar 8, 2026
bep added a commit to bep/hugo that referenced this pull request Mar 8, 2026
@bep bep closed this in 4eafd9e Mar 8, 2026
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.

Template selection considers last media type suffix (alphabetically) instead of first (by slice order)

2 participants