Carpintonto

Carpintonto

Build Websites with Hugo: page 52 Your Turn item 3

  1. Incorporate the social media links into your site’s footer. Include the code in a partial.

I’m stuck and I think it’s a scoping issue.
I pasted the ul block from contact.html into a partial I call social.html

<ul>
  {{ range .Site.Data.socialmedia.accounts }}
    <li><a href="{{ .url }}">{{ .name }}</a></li>
  {{ end }}
</ul>

social.html is getting picked up in the footer.html partial

<footer>
    <small>Copyright {{now.Format "2006"}} {{ .Site.Params.author }}. {{partial "social.html"}}</small>
</footer>

but is just rendering a blank unordered list in the output source

<footer> <small> Copyright 2021 Brian Hogan. <ul></ul> </small> </footer>

First Post!

Carpintonto

Carpintonto

I think I got it. Here’s footer.html

{{ $links := .Site.Data.socialmedia.accounts }}
<footer>
    <small>Copyright {{now.Format "2006"}} {{ .Site.Params.author }}. {{partial "social.html" (dict "links" $links)}}</small>
</footer>

Here’s social.html

<ul>
  {{range .links}}
  <li><a href="{{ .url }}">{{ .name }}</a></li>
  {{end}}
</ul>

I am curious how it might be done without the dict function.

Popular Pragmatic Bookshelf topics Top

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
New
jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
AleksandrKudashkin
On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex&gt; product = %Product{} %Pento....
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
adamwoolhether
I’m not quite sure what’s going on here, but I’m unable to have to containers successfully complete the Readiness/Liveness checks. I’m im...
New
Keton
When running the program in chapter 8, “Implementing Combat”, the printout Health before attack was never printed so I assumed something ...
New

Other popular topics Top

ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
New
AstonJ
Or looking forward to? :nerd_face:
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
PragmaticBookshelf
A Hero’s Journey with Chris Pine @chrispine Chris Pine, author of Learn to Program, Third Edition, discusses his journey to beco...
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New