Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeking help to fix rendering and stylesheet import errors in Hugo project #125

Closed
SamGreenwood1 opened this issue May 11, 2023 Discussed in #124 · 10 comments
Closed

Seeking help to fix rendering and stylesheet import errors in Hugo project #125

SamGreenwood1 opened this issue May 11, 2023 Discussed in #124 · 10 comments

Comments

@SamGreenwood1
Copy link

Discussed in #124

Originally posted by SamGreenwood1 May 11, 2023
$hugo-filecache = /tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/cloudwithchris
I'm encountering two errors in my Hugo project and could use some guidance in resolving them. Here's a summary of the situation:

Error during rendering: When attempting to render a page in my project, an error occurs at line 55 of the template _default/search.html. The specific error is related to the execution of $.Scratch.Add, resulting in a "reflect.Value.Type on zero Value" error.
Stylesheet import error: While building the site, there is an issue with transforming the SCSS file style.main.scss. The error points to line 4 of main.scss and states that the import file bootstrap/functions cannot be found or read.

Actual error messages:

ERROR 2023/05/11 18:41:45 failed to render pages: render of "page" failed: 
"$hugo-filecache/hugo-creator@v0.0.27-0.20220911012120-e40988e0ccc9/layouts/_default/search.html:55:8": 
execute of template failed: template: _default/search.html:55:8: 
executing "main" at <$.Scratch.Add>: error calling Add: reflect: call of reflect.Value.Type on zero Value
Error: Error building site: TOCSS: failed to transform "style.main.scss" (text/x-scss): 
"$hugo-filecache/hugo-creator@v0.0.27-0.20220911012120-e40988e0ccc9/assets/sass/main.scss:4:1": 
File to import not found or unreadable: bootstrap/functions

If you have any experience with these errors or expertise in Hugo and SCSS, I would greatly appreciate your insights and any suggestions for resolving these issues.

@chrisreddington
Copy link
Contributor

@SamGreenwood1 - Some quick verification questions:

  1. For the Hugo version, are you using Hugo extended, and a recent version?
  2. Have you downloaded the needed packages from npm using npm ci/npm install?

The majority of issues where I've seen this come up relate to those two (particularly that last one, given it was unable to read the bootstrap/functions component, so hints at a dependency issue)

@SamGreenwood1
Copy link
Author

Just saw this:

  1. I think so
  2. Which packages?

@SamGreenwood1
Copy link
Author

SamGreenwood1 commented May 27, 2023

I seem to have somehow inadvertently fixed those errors, now I get this one:
WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.
WARN 2023/05/27 19:29:53 .File.UniqueID on zero object. Wrap it in if or with: {{ with .File }}{{ .UniqueID }}{{ end }}

Error: error building site: render: failed to render pages: render of "home" failed: 
"$hugo-filecache/hugo-creator@v0.0.27-0.20220911012120-e40988e0ccc9/layouts/index.html:66:43": 
execute of template failed: template: index.html:66:43: executing "top" at <first 3>:
error calling first: both limit and seq must be provided

@SamGreenwood1
Copy link
Author

SamGreenwood1 commented Jun 5, 2023

I am still having trouble with it. I checked, and index.html matches the repo. I also checked npm, and everything in package.json seems to be installed. To be clear, the rest of the site renders fine, it's just an issue with index.html.

Also, does the theme support the ability to mark episodes "upcoming"?

@SamGreenwood1
Copy link
Author

SamGreenwood1 commented Jun 17, 2023

@chrisreddington Still waiting for help, I've definitely tracked the issue to index.html.

@chrisreddington
Copy link
Contributor

chrisreddington commented Jun 18, 2023

Sorry for the delay. Between holiday and other commitments, I'm only just getting a chance to check back in. I'm wondering if there's some logic on the homepage where I'm expecting certain content to be there, and perhaps there's a scenario I haven't accounted for.

Do you have a repo available to take a peek at what you've got so far?

Yes, upcoming are supported! Just set upcoming to true in the episode frontmatter 😊 for example, you can see this episode has upcoming set to false.

@chrisreddington
Copy link
Contributor

@SamGreenwood1 - I think I've identified the issue. When I build the theme, I create a file in data/popular.json to populate the 'most popular posts' section of the site.

It is an array of strings with the relative file path from the BaseURL to the blog post, e.g.:

["/blog/hello-world/", "/blog/build-2021-summary/", "/blog/jamstack-cloud-winning-combination/", "/blog/api-management-and-policies/", "/blog/static-web-apps-vs-storage-account-static-sites/", "/blog/azuredevops-selfhosted-agents-on-azure/", "/blog/secure-app-service-with-easy-auth-and-app-gateway-public/", "/blog/api-management-and-additional-policies/", "/blog/github-action-docker-dotnet-core/", "/blog/using-oidc-github-actions-azure-swa/"]

I suspect that if you add a dummy file with an empty array, you'll get a successful build. I'm going to add a check to verify if the file exists, and contains an array before using that logic.

@chrisreddington
Copy link
Contributor

Hey @SamGreenwood1, I believe this is now fixed in v0.0.28 of the site. Please can you update to that version and let me know whether all is good? Then we can close the issue :) Thanks!

@stale
Copy link

stale bot commented Aug 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@SamGreenwood1
Copy link
Author

Sorry, I was working at overnight camp through the summer and didn't have time to continue working on this. I'm still getting that error.

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

No branches or pull requests

2 participants