【问题标题】:Hugo Theme Academic: Rename "interests" in about sectionHugo Theme Academic:在 about 部分重命名“interests”
【发布时间】:2020-07-24 21:04:38
【问题描述】:

我正在通过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 将再次显示该列,但仍称为“兴趣”。当另外将&lt;h3&gt; 标记中的i18n "interests" 更改为i18n "work" 时,标题“interests”被删除,仅显示列的内容而没有标题。

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

任何帮助表示赞赏。

【问题讨论】:

    标签: r hugo hugodown


    【解决方案1】:

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

    # About widget
    
    - id: interests
      translation: Interests
    

    这可以改成:

    - id: interests
      translation: Work
    

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

    【讨论】:

    • 我想知道您能否帮我在我的git hub repo 中找到一个位置。我没有主题/学术/i18n/ 文件夹
    • 我是使用 custom.scss 文档完成的,但我认为这不是一个理想的方法
    猜你喜欢
    • 2020-05-05
    • 2020-05-26
    • 1970-01-01
    • 2018-06-08
    • 1970-01-01
    • 1970-01-01
    • 2019-04-14
    • 2019-05-03
    • 1970-01-01
    相关资源
    最近更新 更多