Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

写一个 if (is_post()) 在 localhost:4000 的 post 页面正常显示,deploy 后完全不显示 #3483

Closed
zhwangart opened this issue Mar 13, 2019 · 8 comments
Labels
duplicate This issue or pull request already exists need-investigation

Comments

@zhwangart
Copy link

zhwangart commented Mar 13, 2019

添加不蒜子计数器,写 if (is_post()) 在 localhost:4000 的 post 页面正常显示,deploy 到 github 上则完全不显示,这是什么问题?代码如下:

<% if (is_post()) { %>
  <div><i class="fe fe-bookmark"></i> <span id="busuanzi_value_page_pv"></span></div>
<%} %>
@zhwangart zhwangart changed the title 写一个 if 在 localhost:4000 正常,发布后不正常 写一个 if (is_post()) 在 localhost:4000 正常,发布后不正常 Mar 13, 2019
@zhwangart zhwangart changed the title 写一个 if (is_post()) 在 localhost:4000 正常,发布后不正常 写一个 if (is_post()) 在 localhost:4000 的 post 页面正常显示,deploy 后完全不显示 Mar 13, 2019
@yoshinorin
Copy link
Member

yoshinorin commented Mar 13, 2019

Would you please try to delete db.json before hexo generate.
Or do hexo clean

Data Not Updated
hexo clean

@yoshinorin yoshinorin added the question Needs help in usage label Mar 13, 2019
@zhwangart
Copy link
Author

多次执行 hexo clean 命令,并不起作用...

@yoshinorin
Copy link
Member

Duplicate #2897

@yoshinorin yoshinorin added duplicate This issue or pull request already exists need-investigation and removed question Needs help in usage labels Mar 14, 2019
@yoshinorin
Copy link
Member

yoshinorin commented Mar 14, 2019

Would you please check this comment.

#2503 (comment)

And please try to confirm {cache:true}?

Thanks :)

@zhwangart
Copy link
Author

@yoshinorin

Thank you very much for your help, but I am still confused. My theme is ocean, the problem in _partial/post/busuanzi.ejs, code:

<ul class="list-inline">
  <% if (is_home()) { %>
    <li><i class="fe fe-bar-chart"></i> <span id="busuanzi_value_site_pv"></span></li>
  <%} %>
    <li><i class="fe fe-smile-alt"></i> <span id="busuanzi_value_site_uv"></span></li>
  <% if (is_post()) { %>
    <li><i class="fe fe-bookmark"></i> <span id="busuanzi_value_page_pv"></span></li>
  <%} %>
</ul>

The localhost:4000 home page is displayed normally, if (is_home()) kick in, render out html:

<ul class="list-inline">
    <li><i class="fe fe-bar-chart"></i> <span id="busuanzi_value_site_pv">9934130</span></li>
    <li><i class="fe fe-smile-alt"></i> <span id="busuanzi_value_site_uv">604750</span></li>
</ul>

After the deploy, if (is_home()) seems to disappear, the instance page: https://zhwangart.github.io
Execute the hexo clean command multiple times and upgrade the hexo version to 3.8.0

@yoshinorin
Copy link
Member

yoshinorin commented Mar 18, 2019

@zhwangart
Hmm... It's strange 🤔

I can't reproduce it... Please see below. It seems correct.

@zhwangart
Copy link
Author

zhwangart commented Jul 11, 2019

@zhwangart
Hmm... It's strange 🤔

I can't reproduce it... Please see below. It seems correct.

I have not solved this bug, Could it be because of the hexo version?
The generated html is missing content after executing the hexo generate command。

@stevenjoezhang
Copy link
Member

The discussion of cache continues here: #3738

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists need-investigation
Projects
None yet
Development

No branches or pull requests

3 participants