crisrojas / Zettels

Zettels Hugo Theme
108 stars 14 forks source link

render of "page" failed - error calling Concat: slice #5

Closed hieu6 closed 3 years ago

hieu6 commented 3 years ago

I added the the layouts/partials for backlinks and wikilinks to my personal hugo blog

I added this bit to layouts/index.html.

{{ define "main" }}
    {{ partial "wikilinks.html" . }}
{{ end }}

for good measure, I also added {{ partial "wikilinks.html" . }} at the top of themes/[theme name]/layouts/_default/single.html

tho I am realizing just now that I may not be able to adjust the theme directly if I git clone'd it into my repo (?)


trying it out: in this post I first tried using [[wikilinks]] to call a page using [[file-name.md]] or [[yaml title]] and neither worked to link the pages.

I know I'm missing something. Could someone point me in the right direction?


it is true. I am a noob and not sure what I'm doing but trying my best to follow the docs.

Would anyone here who has attempted and succeeded at implementing this into their own theme be able to assist me with this?

You have my gratitude!

crisrojas commented 3 years ago

Hi hieu, thank you for the interest on the project.

I tried to locally run your blog but I'm not able due to submodule problems with the theme you're using (I'm probably doing something the wrong way). I will retry this weekend and tell you more about that, for now, what I could tell:

Hope that helps :)

crisrojas commented 3 years ago

I tried to serve your hugo project at home, but I wasn't able to run it. This is the workflow I tried:

  1. git clone
  2. git submodule init
  3. git submodule update

It fails at two with the following error:

"fatal: No url found for submodule path 'themes/archie' in .gitmodules"

Maybe you could provide some steps to run your project from a different environment that yours?

hieu6 commented 3 years ago

Cris, thank you for your help with this. theme archie was cloned directly into the themes folder, not as a submodule. The problem is more likely that I broke something in the templates while messing around and I can't remember what it is! Will start over and try again 😅

I love the changes to your theme 'zettels' since it was first released a few months ago! I'd like to use this going forward.

Steps:

  1. hugo new site test26 --> https://github.com/hieu6/test26
  2. git submodule add https://github.com/crisrojas/zettels.git themes/zettels
  3. set theme = "zettels" in config.toml
  4. hugo serve

There are some error messages:

# i added line breaks to make it easier to read

ERROR 2021/09/25 22:49:47 render of "page" failed: 
"/Users/HIEU/site/test26/themes/zettels/layouts/_default/baseof.html:48:62": 
execute of template failed: template: _default/single.html:48:62: executing 
"_default/single.html" at <resources.Concat>: error calling Concat: 
slice []interface {} not supported in concat

ERROR 2021/09/25 22:49:47 render of "home" failed: 
"/Users/HIEU/site/test26/themes/zettels/layouts/_default/baseof.html:48:62": 
execute of template failed: template: index.html:48:62: executing "index.html" 
at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat

Error: Error building site: failed to render pages: render of "page" failed: 
"/Users/HIEU/site/test26/themes/zettels/layouts/_default/baseof.html:48:62": 
execute of template failed: template: _default/single.html:48:62: executing 
"_default/single.html" at <resources.Concat>: error calling Concat: 
slice []interface {} not supported in concat

Below are lines 48:62 of _default/baseof.html

{{ $main := slice $themeVariables $styles $syntax | resources.Concat "css/main.css" | minify | fingerprint }}

    <link rel="stylesheet" href="{{ $main.Permalink }}" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

    {{ $turbolinks := resources.Get "js/turbolinks.js" }}
    {{ $thumbnails := resources.Get "js/thumbnails.js" }}
    {{ $search     := resources.Get "js/search.js" }}

    {{ $.Scratch.Set "jslibs" slice }}
    {{ $libs := slice "js/turbolinks.js" "js/thumbnails.js" "js/search.js" }}

    {{ range $libs }}
    {{ $.Scratch.Add "jslibs" (resources.Get . ) }}

I took a peek and found that assets/css contains style.scss so I changed line 48 to the following:

{{ $main := slice $themeVariables $styles $syntax | resources.Concat "css/style.scss" | minify | fingerprint }}

that didn't work so I changed it back to main.css.... flails, flaps arms I don't know what I'm doing, ha! I checked the hugo docs re: slice but don't understand why terminal is upset.

What do you think, @crisrojas?

[edit] let me know if I should open this as a new issue instead!