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] 部分,但它似乎没有做任何事情。

4

1 回答 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 存储库可能是一个不错的起点。

于 2017-08-20T14:46:47.467 回答