[]map[string]interface {} weird problem

Hi everyone

I got a problem with my data, let me explain :
I have data in my .MD file, looks like this :

app_features = [“Websites”," Keyword Reports",“SEO Reports”," Content Ideas"," Rank Tracking",“Link Opportunities”,“Multi country Targeting”,“Marketing Audit”,“Authority Building”,“Social Media”,“Progress Reports”," Competitive Analysis",“Undying Gratitude”,“Expert Assistance”,“Results Guarantee”,“Whitelabel Reports”,“7-Day Free Trial”,“Bonus Reports”,“”]

When I wanna print my data with use range command Hugo says :

<.Params.app_features>: can’t evaluate field Params in type map[string]interface {}

I used the “apply” and “delimit” command but not works, it shows the same error :frowning:

Thanks for your answer.

Have a nice day

Nice to see what your data looks like. Now show us your template code (that is not working) :wink:

  • “I wanna print my data” <-- how?
  • “I used the apply and delimit command” <-- how?
  • "I have data in my .MD file <-- what .md file? a post? a data file? is it in the front matter? is it in the text itself?

And you could always post a repository that we can look at :slight_smile:

Range Command :

   {{ range $index, $element := .Params.app_features }}
        <div class="line  border-bottom-light px-4">
           <span class="font-size-1rem limit-2-lines">
                  {{ $element }}
            </span>
       </div>
   {{ end  }}

Apply command :
{{ range .Params.app_features }}{{ . | urlize }}{{ end }}

MD file content ( this is a post) :

+++
app_features = [“Websites”," Keyword Reports",“SEO Reports”," Content Ideas"," Rank Tracking",“Link Opportunities”,“Multi country Targeting”,“Marketing Audit”,“Authority Building”,“Social Media”,“Progress Reports”," Competitive Analysis",“Undying Gratitude”,“Expert Assistance”,“Results Guarantee”,“Whitelabel Reports”,“7-Day Free Trial”,“Bonus Reports”,""]
+++

I’m not able to reproduce this issue. What version of Hugo are you running? See hugo version

Hugo Static Site Generator v0.74.3/extended darwin/amd64

I can’t reproduce with:

Hugo Static Site Generator v0.58.3-4AAC02D4 linux/amd64
Hugo Static Site Generator v0.74.3-DA0437B4 linux/amd64
Hugo Static Site Generator v0.76.3-E9623459 linux/amd64
Hugo Static Site Generator v0.77.0-DEV-8CBE2BBF linux/amd64

Changes tested against example blog in Hugo sources:

diff --git a/examples/blog/content/post/another-post.md b/examples/blog/content/post/another-post.md
index 057c2d27..2d85b857 100644
--- a/examples/blog/content/post/another-post.md
+++ b/examples/blog/content/post/another-post.md
@@ -8,6 +8,7 @@ tags = [
     "hugo",
     "toml"
 ]
+app_features = ["Websites"," Keyword Reports","SEO Reports"," Content Ideas"," Rank Tracking","Link Opportunities","Multi country Targeting","Marketing Audit","Authority Building","Social Media","Progress Reports","Competitive Analysis","Undying Gratitude","Expert Assistance","Results Guarantee","Whitelabel Reports","7-Day Free Trial","Bonus Reports",""]
 +++

 TOML, YAML, JSON --- Oh my!
diff --git a/examples/blog/layouts/post/single.html b/examples/blog/layouts/post/single.html
index 4b792ebe..e48c2b59 100644
--- a/examples/blog/layouts/post/single.html
+++ b/examples/blog/layouts/post/single.html
@@ -7,6 +7,17 @@
             <div class="well well-sm">
                     <h3>{{ .Title }}<br> <small>{{ .Description }}</small></h3>
                     <hr>
+XXX<br/>
+{{ range $index, $element := .Params.app_features }}
+    <div class="line  border-bottom-light px-4">
+        <span class="font-size-1rem limit-2-lines">
+              {{ $element }}
+        </span>
+    </div>
+{{ end  }}
+XXX<br/>
+{{ range .Params.app_features }}{{ . | urlize }}<br/>{{ end }}
+<hr>
                     {{ .Content }}
             </div>
         </div>
1 Like