Skip to content

hugolib: include content file path in error messages#14688

Open
xingzihai wants to merge 1 commit intogohugoio:masterfrom
xingzihai:fix/issue-14607-error-message-content-file
Open

hugolib: include content file path in error messages#14688
xingzihai wants to merge 1 commit intogohugoio:masterfrom
xingzihai:fix/issue-14607-error-message-content-file

Conversation

@xingzihai
Copy link
Copy Markdown
Contributor

Problem

When Hugo encounters an error during content file rendering, the error message does not include which content file caused the issue, making it difficult for users to identify the problematic file.

Solution

Modified the renderForTemplate function in hugolib/site.go to include the page path in error messages when a template render fails for a page.

Changes

  • When a render error occurs and the data is a *pageState, the error message now includes the page path
  • Error format: render of "template_name" failed for "page_path": original_error

Example

Before:
render of "list" failed: template: ...

After:
render of "list" failed for "content/posts/my-post.md": template: ...

Closes #14607

When a template render fails, include the page path in the error message
to help users identify which content file caused the issue.

Closes gohugoio#14607
@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

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.

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.

Error 'render of "page" failed' does not mention content file

2 participants