iissnan / hexo-theme-next

Elegant theme for Hexo.
http://notes.iissnan.com
MIT License
15.87k stars 3.62k forks source link

使用next主题时hexo generate生成主页文章数量不完整 #594

Closed winterTTr closed 8 years ago

winterTTr commented 8 years ago

我也是无意中才注意到的,暂时不确定是我个人的配置问题,还是next对网站编译的影响,iissnan可以给点建议。我刚刚重新git clone一份自己的代码,然后再次hexo g了一次,结果是一样的。 我的详细配置全部在我的github里面 https://github.com/winterTTr/winterTTr.github.io/tree/hexo-content

具体情况是这样,如果不使用next主题,主页(index)生成的文章会包含”冲绳“旅行的这篇文章。但是,使用了next,主页就没有这篇文章了,第二页也没有(我一共两页主页),就是说,在主页中无法找到这篇文章。但是可以在archeive里面找到,点击链接也能进入。我现在已经部署出去的网站就是有问题,可以参考这里 winterTTr.me。主页的所有文章中都不包含”三年签证之冲绳两日游“,但是在archieves里面可以找到。

我本地用hexo s预览的话,表现是这样的:如果只是hexo server的话,是可以看到文章的,但是hexo server -s的话(即不使用动态编译,只是使用public文件夹的内容预览),就是缺少刚刚提到的文章。但是部署本身会使用public中的静态文件,所以我部署出去的网站就有问题了。

我本地已经尝试hexo clean && hexo generate重新生成所有的,也不能解决问题。

所以,我想问一下iissnan是否有可能是next的问题,或者是我的某些配置引起的? 至少我现在如果不使用next,就不会出现刚刚说的问题。

kisnows commented 8 years ago

我也遇到了这个问题,貌似是在时间跨年的时候会有。 2016-01-12_215623 下面是主题的配置文件,

# ---------------------------------------------------------------
# Site Information Settings
# ---------------------------------------------------------------

# Place your favicon.ico to /source directory.
favicon: /favicon.ico

# Set default keywords (Use a comma to separate)
keywords: "JavaScript,JS,Web Develop,Front end,前端开发,Kisnows"

# Set rss to false to disable feed link.
# Leave rss as empty to use site's feed link.
# Set rss to specific value if you have burned your feed already.
rss:

# Specify the date when the site was setup
since: 2014

# ---------------------------------------------------------------
# Menu Settings
# ---------------------------------------------------------------

# When running hexo in a subdirectory (e.g. domain.tld/blog)
# Remove leading slashes ( "/archives" -> "archives" )
menu:
  home: /
  categories: /categories
  #about: /about
  archives: /archives
  tags: /tags
  #commonweal: /404.html

# Enable/Disable menu icons.
# Icon Mapping:
#   Map a menu item to a specific FontAwesome icon name.
#   Key is the name of menu item and value is the name of FontAwsome icon.
#   When an question mask icon presenting up means that the item has no mapping icon.
menu_icons:
  enable: true
  # Icon Mapping.
  home: home
  about: user
  categories: th
  tags: tags
  archives: archive
  commonweal: heartbeat

# ---------------------------------------------------------------
# Scheme Settings
# ---------------------------------------------------------------

# Schemes
#scheme: Muse
#scheme: Mist
scheme: Pisces

# ---------------------------------------------------------------
# Sidebar Settings
# ---------------------------------------------------------------

# Social links
# social:
  #GitHub:
  #Others:

# Social Icons
social_icons:
  enable: true
  # Icon Mappings
  GitHub: github
  Twitter: twitter
  Weibo: weibo

# Sidebar Avatar
avatar: '/imgs/avatar.jpg'

# TOC in the Sidebar
toc:
  enable: true

  # Automatically add list number to toc.
  number: true

# Creative Commons 4.0 International License.
# http://creativecommons.org/
# Available: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
creative_commons: by-nc-sa
#creative_commons:

sidebar:
  # Sidebar Position, available value: left | right
  position: left
  #position: right

  # Sidebar Display, available value:
  #  - post    expand on posts automatically. Default.
  #  - always  expand for all pages automatically
  #  - hide    expand only when click on the sidebar toggle icon.
  #  - remove  Totally remove sidebar including sidebar toggle icon.
  display: post
  #display: always
  #display: hide
  #display: remove

# ---------------------------------------------------------------
# Misc Theme Settings
# ---------------------------------------------------------------

# Custom Logo.
# !!Only available for Default Scheme currently.
# Options:
#   enabled: [true/false] - Replace with specific image
#   image: url-of-image   - Images's url
custom_logo:
  enabled: false
  image:

# Code Highlight theme
# Available value:
#    normal | night | night eighties | night blue | night bright
# https://github.com/chriskempson/tomorrow-theme
highlight_theme: normal

# Automatically scroll page to section which is under <!-- more --> mark.
scroll_to_more: true

# Automatically Excerpt
auto_excerpt:
  enable: false
  length: 150

# Use Lato font
use_font_lato: true

# ---------------------------------------------------------------
# Third Party Services Settings
# ---------------------------------------------------------------

# MathJax Support
mathjax:

# Swiftype Search API Key
#swiftype_key:

# Baidu Analytics ID
#baidu_analytics:

# Duoshuo ShortName
#duoshuo_shortname:

# Disqus
#disqus_shortname:

# Share
#jiathis:

# Share
#duoshuo_share: true

# Google Webmaster tools verification setting
# See: https://www.google.com/webmasters/
#google_site_verification:

# Google Analytics
#google_analytics:

# Make duoshuo show UA
# user_id must NOT be null when admin_enable is true!
# you can visit http://dev.duoshuo.com get duoshuo user id.
duoshuo_info:
  ua_enable: false
  admin_enable: false
  user_id: 0
  #admin_nickname: ROOT

# Facebook SDK Support.
# https://github.com/iissnan/hexo-theme-next/pull/410
facebook_sdk:
  enable: false
  app_id:       #<app_id>
  fb_admin:     #<user_id>
  like_button:  #true
  webmaster:    #true

# Show number of visitors to each article.
# You can visit https://leancloud.cn get AppID and AppKey.
leancloud_visitors:
  enable: true
  app_id: ************
  app_key: **********

#! ---------------------------------------------------------------
#! DO NOT EDIT THE FOLLOWING SETTINGS
#! UNLESS YOU KNOW WHAT YOU ARE DOING
#! ---------------------------------------------------------------

# Motion
use_motion: false

# Fancybox
fancybox: false

# Static files
vendors: vendors
css: css
js: js
images: images

# Theme version
version: 5.0.0
winterTTr commented 8 years ago

我这里今年还没开始写,所以应该不单纯是跨年的问题。主要是我不知道这个问题该从哪里下手查,否则我就自己先研究一下了

winterTTr commented 8 years ago

更新一下,我刚刚在config去掉了next的主题,clean和generate了一下,然后再恢复配置文件,再生成一次,似乎现在又正常了。不确定是不是next的问题还是hexo的问题。如果有人遇到可以尝试一下这个临时的办法

xcatliu commented 8 years ago

遇到了同样的问题,按照楼上的方法解决掉了。

xcatliu commented 8 years ago

@tommy351 @Xuanwo 麻烦看看这个吧

Xuanwo commented 8 years ago

感觉应该@iissnan,我都是采用Travis部署,没有遇到过这个问题,可能跟缓存有点关系。

iissnan commented 8 years ago

我回头看看

jcf94 commented 8 years ago

这个好像是好多个版本前的Next就出现的Bug,每次生成都需要hexo g两次就正常了,hexo s也是需要两次。

ForeverQ commented 8 years ago

反复尝试了一下,发现每次需要 hexo clean 后连续两次 hexo generate 可稳定解决此问题。目前使用 NexT.Pisces

winterTTr commented 8 years ago

有一点我想提醒大家,直接使用hexo server这个命令的时候,是会动态编译所有的md文件的。所以这个时候预览可能是正确的,但是public文件夹里的内容可能不对。这就会造成本地预览是正确的,但是部署出去不正确。

只预览本地public的内容,需要使用hexo server -s

xcatliu commented 8 years ago

@winterTTr 原来如此,受教了👍

Xuanwo commented 8 years ago

会是最新版本更新引入的问题么?我的NexT自己修改了很多,距离线上版本已经很远了。。

kisnows commented 8 years ago

原来如此,我还纳闷说怎么本地是好的,depoly上去就错了。

winterTTr notifications@github.com于2016年1月14日周四 下午5:56写道:

有一点我想提醒大家,直接使用hexo server 这个命令的时候,是会动态编译所有的md文件的。所以这个时候预览可能是正确的,但是public文件夹里的内容可能不对。这就会造成本地预览是正确的,但是部署出去不正确。

只预览本地public的内容,需要使用hexo server -s

— Reply to this email directly or view it on GitHub https://github.com/iissnan/hexo-theme-next/issues/594#issuecomment-171591571 .

jcf94 commented 8 years ago

我印象中是从置顶功能推出之后就这样了吧...需要generate 2次 Next的置顶是用了个filter实现的,不管用没用置顶的功能都要经过filter,猜测是不是hexo在这里的机制有点问题

Xuanwo commented 8 years ago

大概是这里: https://github.com/iissnan/hexo-theme-next/blob/master/scripts/filters/sticky.js#L5

hz-cheng commented 8 years ago

还以为是我配置哪里搞错了,然后清理仓库重新来,发现还是如此。后来发现-g两次会就能解决,google一下果然发现大家也有这个状况。关注这个问题,希望能够尽快解决,谢谢。

iissnan commented 8 years ago

如 @jcf94 @Xuanwo 所说,应该是 sticky.js filter 引入的问题,已将此文件去除。请更新下主题

stevenjoezhang commented 4 years ago

Hexo 已实现文章置顶参数: hexojs/hexo-generator-index#51