Hugo Theme Academic:在 about 部分重命名 "interests"

Hugo Theme Academic: Rename "interests" in about section

我正在通过 hugodown 在 R 中建立一个学术主题的 Hugo 网站。在“关于”部分有一个名为“兴趣”的列,我想将其重命名为“工作”。

到目前为止我做了什么:

content/authors/admin/_index.md 文件包含以下代码:

interests: # <- I want to rename this into 'work'
- Artificial Intelligence
- Computational Linguistics
- Information Retrieval

如果仅重命名此文件,则不会显示整个“兴趣”栏。

还有另一个文件 layouts/partial/widgets/about.html,其中包含以下代码:

  {{ with $person.interests }}
  <div class="col-md-5">
    <h3>{{ i18n "interests" | markdownify }}</h3>
    <ul class="ul-interests">
      {{ range . }}
      <li>{{ . | markdownify | emojify }}</li>
      {{ end }}
    </ul>
  </div>
  {{ end }}

除了上述更改外,将with $person.interests 命名为with $person.work 将再次显示该列,但仍称为“兴趣”。当另外将 <h3> 标记中的 i18n "interests" 更改为 i18n "work" 时,标题“兴趣”将被删除,并且仅显示没有标题的列内容。

新的列名称“work”似乎必须在其他地方注册才能正确显示。

感谢任何帮助。

经过一番摸索,我找到了问题的答案。如我所料,有一个文件,其中注册了所有 id 及其 translation。这取决于选择的语言。如果选择的语言是英语 en,那么转到文件夹 themes/academic/i18n/ 并打开文件 en.yaml 就足够了。在这里我们发现:

# About widget

- id: interests
  translation: Interests

这可以更改为:

- id: interests
  translation: Work

现在网站将在“关于”小部件页面上正确显示“工作”而不是“兴趣”。