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

Feature Request: Hide posts from the index #88

Open
zhang-stephen opened this issue Dec 7, 2022 · 1 comment
Open

Feature Request: Hide posts from the index #88

zhang-stephen opened this issue Dec 7, 2022 · 1 comment

Comments

@zhang-stephen
Copy link

Is it possible to add an option, e.g. hidden: true, into front matter, and to remove this post from the index page?

@SukkaW
Copy link
Member

SukkaW commented Dec 8, 2022

@zhang-stephen

Currently, the hexo-generator-index doesn't have such an option, but hexo themes can implement this very easily! Here is an example with .ejs:

<!-- Post List -->
<% page.posts.each((post) => { %>
  <!-- Post Entry -->
  <%- partial('_partial/post-entry', { post }) %>
<% }); %>
<!-- Post List -->
<% page.posts.each((post) => { %>
  <!-- Post Entry -->
+ <% if (post.hidden !== true) { %>
  <%- partial('_partial/post-entry', { post }) %>
+ <% } %>
<% }); %>

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

No branches or pull requests

2 participants