Issues with the Cupper Theme

I had just started with Hugo and loved the Cupper Theme. As per the instructions given in the github page GitHub - zwbetz-gh/cupper-hugo-theme: An accessibility-friendly Hugo theme, ported from the original Cupper project. I had downloaded the theme using the git command as appropriately and it was successful as well.

git submodule add https://github.com/zwbetz-gh/cupper-hugo-theme.git themes/cupper-hugo-theme
git submodule update --remote --merge

However when I ran the server with ‘hugo server -D’, it get the following error on the console.

λ hugo new posts/my-first-post.md
Error: add site dependencies: load resources: loading templates: "C:\hugoPractices\hugo-cupper-theme-test\themes\cupper-hugo-theme\layouts\partials\head.html:14:1": parse failed: template: partials/head.html:14: unclosed action

And this is what I see in line 14 and 15

    {{ $summary := trim (.Summary | plainify | htmlUnescape) 
  | default .Title }}

I tried bringing the line 15 to 14 (towards the end) but that gave various different set of errors.

Can someone advise what went wrong? I did not do any changes except downloaded the theme via git into my hugo project.

It seems that you are using an older version of Hugo.

Support for newlines in template functions was introduced in v.0.81.0.

You need to update your Hugo installation.

3 Likes

Thank you @alexandros . However i just installed it afresh from Chocolatey. I expect that it should have pulled out the latest repo. Right ?

λ hugo version
Hugo Static Site Generator v0.80.0-792EF0F4 windows/amd64 BuildDate: 2020-12-31T13:37:57Z

Little I had a clue that it was not the up to date. Let me check and update it.

It was my bad. I had two different versions of Hugo installed. I had an earlier version installed elsewhere (older version - 0.80) which was set in the PATH environment variable. Today I had installed it via Chocolatey and it was not set in the path, and hence it caused the confusion when I simply invoked ‘hugo’ it took the older version.

After I updated the PATH environment variable with the latest version of hugo with the following steps,it solved the problem.

Prefixing the latest HUGO path in the PATH env variable, so that it gets picked up.

C:\raghs\prfsnl\hugoPractices\hugo-cupper-theme-test (master)
λ set PATH=C:\ProgramData\chocolatey\lib\hugo\tools;%PATH%

Later when I invoke hugo on the same terminal/command prompt, it is verifying the latest.

λ hugo version
hugo v0.83.1-5AFE0A57 windows/amd64 BuildDate=2021-05-02T14:38:05Z VendorInfo=gohugoio

Also, it solves the problem. I dont get any errors when I run the hugo server.

C:\raghs\prfsnl\hugoPractices\hugo-cupper-theme-test (master)
? hugo server -D
Start building sites …

                   | EN
-------------------+-----
  Pages            |  6
  Paginator pages  |  0
  Non-page files   |  0
  Static files     | 32
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Built in 38 ms
Watching for changes in C:\raghs\prfsnl\hugoPractices\hugo-cupper-theme-test\{archetypes,content,data,layouts,static,themes}
Watching for config changes in C:\raghs\prfsnl\hugoPractices\hugo-cupper-theme-test\config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Thanks for bringing this up @itsraghz. I’ll update the README here and in my other themes with the new minimum hugo version required.

Thanks @alexandros for pointing out the solution.

3 Likes

You are very welcome @zwbetz . In fact, the first and best loved theme of Hugo is yours - Cupper Theme. I do have some struggles in setting it up. I am in the process of learning Hugo now with a few other templates.

My Ultimate target is to set up my blog site on Server is with Cupper theme. I will surely be getting back to you for any assistance needed. Kindly do help me out :slight_smile: Thank you in advance !!! :tada:

1 Like

Fixed.

2 Likes

Hello @zwbetz , that is so lovely and quick. Thanks for the confirmation on the fix you made. I really appreciate the diligence you show!! Keep up the great spirits!!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.