2017-07-10 44 views
1

我正在通過RStudio/blogdown使用hugo-academic主題來構建我的網頁。示例頁面位於:https://themes.gohugo.io/theme/academic/在hugo學術主題中自定義「關於」小部件

我想添加第二個非學術名單興趣低於學術類別。這可能嗎?

about.md配置部分有此列表

# List your academic interests. 
[interests] 
    interests = [ 
    "Artificial Intelligence", 
    "Computational Linguistics", 
    "Information Retrieval" 
    ] 

一個部分,但我不知道它是如何傳遞到實際建立網站的過程。本着「只是添加東西來看看它是否有效」的精神,我嘗試添加另一個[other_interests]部分,但它似乎沒有做任何事情。

回答

2

您可以添加另一個興趣列表,但主題不知道您添加的列表。在主題的來源,你會發現本節:

{{ 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部分。
你可以嘗試複製/粘貼此節並更改interestsother_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可能是一個很好的開始。

相關問題