自定义Hugo Academic主题中的“关于”小部件

3
我正在使用RStudio / blogdown通过hugo-academic主题来构建我的网页。示例页面在此处:https://themes.gohugo.io/theme/academic/ 我想在学术兴趣下方添加第二个非学术兴趣列表。这是否可行?
about.md的配置部分中有一个用于此列表的部分。
# List your academic interests.
 [interests]
   interests = [
     "Artificial Intelligence",
     "Computational Linguistics",
     "Information Retrieval"
   ]

但我不确定它是如何传递给实际构建网站的过程的。为了“只需添加内容以查看其是否有效”的精神,我尝试添加了另一个[other_interests]部分,但似乎没有任何作用。

1个回答

6
你可以添加另一个兴趣列表,但主题不知道你添加的列表。在主题源代码中,您会找到以下部分:
  {{ with $page.Params.interests }}
  <div class="col-sm-5">
    <h3>{{ i18n "interests" | markdownify }}</h3>
    <ul class="ul-interests">
      {{ range .interests }}
      <li>{{ . }}</li>
      {{ end }}
    </ul>
  </div>
  {{ end }}

https://github.com/gcushen/hugo-academic/blob/master/layouts/partials/widgets/about.html#L50-L59

根据预定义的列表,它呈现一个HTML部分。您可以尝试复制/粘贴此部分并将“interests”更改为您的“other_interests”,看看效果如何:
  {{ with $page.Params.other_interests }}
  <div class="col-sm-5">
    <h3>{{ i18n "interests" | markdownify }}</h3>
    <ul class="ul-interests">
      {{ range .other_interests }}
      <li>{{ . }}</li>
      {{ end }}
    </ul>
  </div>
  {{ end }}

我建议阅读一下Hugo中的模板,以更好地了解其中发生的情况。如果您有关于这个主题的更多问题,也许源GitHub存储库可能是一个好的起点。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接