Skip to content

Fix an issue about the categories/tags count. #42

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

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

tsanie
Copy link
Contributor

@tsanie tsanie commented Jan 17, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes have been added (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs have been added / updated (for bug fixes / features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

I have an article in the _drafts that contains 2 tags: compression, pngquant.
But the tags page shows the number with all articles including the draft ones.

  • Screens like this:
    image

What is the new behavior?

This commit changes the variable from reading site.tags.length to site.tags.filter(t => t.length).length, to make sure the result number will be right. (Also changes the categories)

But I'm not familiar with swig, so the single filter is splitted to 6 lines, so it looks like too verbose. 😒

  • Screens with this changes:
    image

Does this PR introduce a breaking change?

  • Yes.
  • No.

Copy link
Member

@ivan-nginx ivan-nginx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good, yeah. This bug is so old what i forget about it. GJ.

@ivan-nginx
Copy link
Member

ivan-nginx commented Jan 17, 2018

P.S. For Archives mb need to do the same thing.

@tsanie
Copy link
Contributor Author

tsanie commented Jan 18, 2018

🎉 The Archives seems ok, site.posts will only returns posts which are published if we don't change the render_drafts to true.

@tsanie tsanie deleted the categories_tags_count_issue branch January 18, 2018 00:28
@zhuzhuyule
Copy link
Contributor

Good Fixed !

tsanie added a commit to tsanie/hexo-theme-next that referenced this pull request Jan 25, 2018
@youngjuning
Copy link

Good Fixed !

@jiangtj
Copy link
Member

jiangtj commented May 9, 2019

This is one of the reasons for the slow generation, maybe we can do it in scripts/merge-config.js.
Related issues #661 #539

stevenjoezhang added a commit that referenced this pull request Jul 14, 2019
stevenjoezhang added a commit that referenced this pull request Jul 16, 2019
stevenjoezhang added a commit that referenced this pull request Jul 16, 2019
stevenjoezhang added a commit that referenced this pull request Aug 31, 2019
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
Fix an issue about the categories/tags count.
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
@stevenjoezhang
Copy link
Contributor

Superseded by hexojs/hexo#3624

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants