【问题标题】:Customize the "about" widget in hugo academic theme自定义雨果学术主题中的“关于”小部件
【发布时间】:2017-12-14 19:41:49
【问题描述】:

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

【问题讨论】:

    标签: r hugo blogdown


    【解决方案1】:

    您可以添加另一个兴趣列表,但主题不知道您添加的列表。在主题的源代码中,您会找到以下部分:

      {{ 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 }}
    

    我建议阅读templating in Hugo 以更好地了解那里发生的事情。如果您对此主题有更多具体问题,也许source GitHub repository 可能是一个不错的起点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-03
      • 1970-01-01
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多