Ben02 / hexo-theme-Anatole

A white and simple Hexo theme, originated from a Farbox theme
MIT License
642 stars 120 forks source link

add a tab in file (nav.yml ) #52

Open nyz123 opened 5 years ago

nyz123 commented 5 years ago

增加一条if判断就行了,然后在/anatole/languages/zh-cn.yml中增加词条 Categories: 分类,不过我也遇到一个问题,tab页选中后无样式类active,导致样式与其他不符,求助作者 @Ben02

image image

粘上我的代码。

.page-top.animated.fadeInDown
  .nav
    li
      if is_home()
        a.current(href="/")= __('Home')                 
      else
        a(href="/")= __('Home') 
    li
      if is_current('Categories')
        a.current(href="/categories")= __('Categories')                 
      else
        a(href="/categories")= __('Categories') 
    li
      if is_archive()
        a.current(href="/archives")= __('Archive')
      else
        a(href="/archives")= __('Archive')
    li
      if is_current('about')
        a.current(href="/about")= __('About')           
      else
        a(href="/about")= __('About')   
  .information
    .back_btn
      li
        if is_post()
          a.fa.fa-chevron-left(onclick="window.history.go(-1)") 
        else
          a.fa.fa-chevron-left(onclick="window.history.go(-1)",style="display:none;") 
    .avatar
      img(src=theme.avatar)

Originally posted by @nyz123 in https://github.com/Ben02/hexo-theme-Anatole/issues/51#issuecomment-478466676