Giter Site home page Giter Site logo

prinsss / hexo-hide-posts Goto Github PK

View Code? Open in Web Editor NEW
188.0 188.0 19.0 263 KB

A plugin to hide specific posts from your Hexo blog and make them only accessible by links. (隐藏 Hexo 文章)

License: MIT License

JavaScript 100.00%
hexo hexo-plugin hide unlisted

hexo-hide-posts's People

Contributors

h404bi avatar prinsss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hexo-hide-posts's Issues

隐藏文章的Toc也没有显示了

在使用过程中, 发现设置了隐藏后的文章, Toc也没有了。

隐藏掉Top,不知这是一个正常的功能, 还是一个被躺枪的牵连?

报错

安装后hexo g时

TypeError: Cannot read property 'includes' of null
    at Hexo.<anonymous> (D:\hexo\node_modules\hexo-hide-posts\index.js:125:13)
    at Hexo.tryCatcher (D:\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Hexo.<anonymous> (D:\hexo\node_modules\bluebird\js\release\method.js:15:34)
    at D:\hexo\node_modules\hexo\lib\extend\filter.js:62:52
    at tryCatcher (D:\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Object.gotValue (D:\hexo\node_modules\bluebird\js\release\reduce.js:166:18)
    at Object.gotAccum (D:\hexo\node_modules\bluebird\js\release\reduce.js:155:25)
    at Object.tryCatcher (D:\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\hexo\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (D:\hexo\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (D:\hexo\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (D:\hexo\node_modules\bluebird\js\release\promise.js:729:18)
    at _drainQueueStep (D:\hexo\node_modules\bluebird\js\release\async.js:93:12)
    at _drainQueue (D:\hexo\node_modules\bluebird\js\release\async.js:86:9)
    at Async._drainQueues (D:\hexo\node_modules\bluebird\js\release\async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\hexo\node_modules\bluebird\js\release\async.js:15:14)
    at processImmediate (internal/timers.js:456:21)

似乎并不能隐藏

使用的版本是最新版
这是 hexo version 的输出

hexo: 4.2.0
hexo-cli: 3.1.0
os: Windows_NT 10.0.18363 win32 x64
node: 13.8.0
v8: 7.9.317.25-node.28
uv: 1.34.1
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 79
nghttp2: 1.40.0
napi: 5
llhttp: 2.0.4
openssl: 1.1.1d
cldr: 36.0
icu: 65.1
tz: 2019c
unicode: 12.1

这是 package.json

{
    "name": "hexo-site",
    "version": "0.0.0",
    "private": true,
    "scripts": {
        "build": "hexo generate",
        "clean": "hexo clean",
        "deploy": "hexo deploy",
        "server": "hexo server"
    },
    "hexo": {
        "version": "4.2.0"
    },
    "dependencies": {
        "aplayer": "^1.10.1",
        "hexo": "^4.2.0",
        "hexo-abbrlink": "^2.0.5",
        "hexo-auto-category": "^0.2.0",
        "hexo-baidu-url-submit": "0.0.6",
        "hexo-blog-encrypt": "^3.0.12",
        "hexo-cli": "^3.1.0",
        "hexo-deployer-git": "^2.1.0",
        "hexo-generator-archive": "^1.0.0",
        "hexo-generator-baidu-sitemap": "^0.1.6",
        "hexo-generator-category": "^1.0.0",
        "hexo-generator-feed": "^2.2.0",
        "hexo-generator-index": "^1.0.0",
        "hexo-generator-search": "^2.4.0",
        "hexo-generator-searchdb": "^1.2.0",
        "hexo-generator-sitemap": "^2.0.0",
        "hexo-generator-tag": "^1.0.0",
        "hexo-hide-posts": "^0.1.0",
        "hexo-offline": "^1.0.0",
        "hexo-renderer-ejs": "^1.0.0",
        "hexo-renderer-marked": "^2.0.0",
        "hexo-renderer-pug": "^1.0.0",
        "hexo-renderer-stylus": "^1.1.0",
        "hexo-server": "^1.0.0",
        "hexo-symbols-count-time": "^0.7.0",
        "hexo-tag-aplayer": "^3.0.4",
        "hexo-wordcount": "^6.0.1",
        "image-size": "^0.8.3"
    }
}

可以看看怎么回事吗

public_generators: []不生效

我这样填的配置:

hide_posts:
  filter: hide
  # 常见的 generators 有:index, tag, category, archive, sitemap, feed, etc.
  public_generators: [category]
  noindex: true

但指定隐藏的文章并没有生成在categories目录下

会导致在打草稿时 hexo-server 不能热刷新文章

不知道你能否复现。

hexo new draft just-a-draft
hexo clean && hexo s --draft --debug

just-a-draft.md

---
title: just-a-draft
draft: true
hidden: true
comments: false
---

编辑 just-a-draft.md,hexo-server 热刷新后,文章会无法访问(还有一种情况是,文章一直是刚启动 hexo server 时的状态,编辑更新的内容不出现)。

如何設定兩種 public genterator?

我想要一部份文章套用 public_generators: ['xml', 'json']
另一些文章套用 public_generators: ['index', 'tag', 'category', 'archive', 'xml', 'json']

請問是否存在某種方式可以達到?

Pages

Am I right that this does not work for a page? Can I change that somewhere so it does allow for pages to be hidden?

期望能够有办法避免对site.posts.length的影响的方法

想要显示完整的文章总数,但是似乎隐藏的文章不计入总数。
请问有什么方式可以优化,感谢!

当前配置:

# 隐藏文章
hide_posts:
  # 是否启用 hexo-hide-posts
  enable: true

  # 隐藏文章的 front-matter 标识,也可以改成其他你喜欢的名字
  filter: hidden

  # 为隐藏的文章添加 noindex meta 标签,阻止搜索引擎收录
  noindex: false

  # 设置白名单,白名单中的 generator 可以访问隐藏文章
  # 常见的 generators 有:index, tag, category, archive, sitemap, feed, etc.
  allowlist_generators: ['*']

  # 设置黑名单,黑名单中的 generator 不可以访问隐藏文章
  # 如果同时设置了黑名单和白名单,白名单的优先级更高
  blocklist_generators: ['index']

本插件后续更新计划

一系列 TODO,旨在使本插件更为通用。

  • hexo-sage-posts 更名为 hexo-hide-posts
    • 说实话我也不知道当初为什么选了这个名字,想想还是改一下好
    • 变更将包括 GitHub 仓库名与 npm 包名
  • 提供自定义隐藏文章的 filter 选项 #2
    • sage: true 或者 hide: true
  • 修复「上一篇」「下一篇」造成文章入口暴露的问题 #1
  • 允许指定对特定的某些 generator 隐藏文章
    • 如仅对 index 隐藏(即在首页隐藏指定文章)、仅对 feed 隐藏等

预计本周末开始着手开发(欢迎 PR)。

输入Url后, 也不能查看?

能不能彻底隐藏某篇文章? 即当隐藏的文章,被知道URL后,在浏览器里访问时, 也会给一个恰当的反馈, 而不是像现在一样,可以正常查看?

是否有一个Hidden文章的列表?

现在使用Sage管理隐藏文章, 后面可能随着影藏文章的变多, 一些链接自己也记不住了。

这样, 针对这个问题, 是否考虑添加隐藏文章的列表, 方便查看已经隐藏的文章?

当然,现在想到一些方法是, 使用某些Linux命令来搜索sage的关键字。这个方法可以达到效果,但繁琐。
所以还是期望在Sage中能有这样一个功能。

隐藏文章的分类

请问想弄一个隐藏文章的分类页面该如何实现?
就是像普通的分类那样但是里面都是隐藏的文章

public_generators为archive时数据不对

配置public_generators: [archive]时虽然归档页面可以展示隐藏文章了,但归档页面的计数没有计上

image

这里的目前共计 13 篇日志应该是没计算上隐藏文章的, 但个人理解如果希望在archive里展示的话,计数器也应该计算上隐藏文章才合理?

能否仅对部分generator隐藏文章?

个人只想在首页隐藏一些杂乱的文章
但是按照目前插件的功能,只能手动把除了index以外的所有generator都添加到public_generators
包括但不限于:tag, category, archive, sitemap, feed, xml, json, wordcount………对于其他人来说可能会更多
能否添加一个反选功能?
还是挺需要这个的qwq

hexo-generator-feed 中没有隐藏文章

我的配置:

# hexo-hide-posts
## https://github.com/prinsss/hexo-hide-posts
hide_posts:
  enable: true
  # 可以改成其他你喜欢的名字
  filter: hidden
  # 指定你想要传递隐藏文章的 generator,比如让所有隐藏文章在存档页面可见
  # 常见的 generators 有:index, tag, category, archive, sitemap, feed, etc.
  # 不常见的还有 xml (butterfly 主题的 hexo-generator-search 搜索,hexo-generator-searchdb 也是这个)
  public_generators: [archive,category,tag,sitemap,baidusitemap,xml,feed]
  # 为隐藏的文章添加 noindex meta 标签,阻止搜索引擎收录
  noindex: false

Hexo 插件:

$ hexo -v
INFO  Validating config
INFO
  ===================================================================
      #####  #    # ##### ##### ###### #####  ###### #      #   #
      #    # #    #   #     #   #      #    # #      #       # #
      #####  #    #   #     #   #####  #    # #####  #        #
      #    # #    #   #     #   #      #####  #      #        #
      #    # #    #   #     #   #      #   #  #      #        #
      #####   ####    #     #   ###### #    # #      ######   #
                            4.6.0
  ===================================================================
hexo: 6.3.0
hexo-cli: 4.3.0
os: win32 10.0.22621
node: 18.13.0
v8: 10.2.154.23-node.21
uv: 1.44.2
zlib: 1.2.13
brotli: 1.0.9
ares: 1.18.1
modules: 108
nghttp2: 1.51.0
napi: 8
llhttp: 6.0.10
uvwasi: 0.0.13
openssl: 3.0.7+quic
cldr: 42.0
icu: 72.1
tz: 2022f
unicode: 15.0
ngtcp2: 0.8.1
nghttp3: 0.7.0

隐藏文章(NSFW):https://www.pil0txia.com/post/2022-12-09_chatgpt-teach-stable-diffusion-nsfw/

使用 hexo-generator-feed 生成的atom:https://www.pil0txia.com/atom.xml

期待您的回复,谢谢

[Bug] 使用该插件后生成时报错

主题是hexo-theme-butterfly,报错如下,请问怎么解决?
截屏2022-12-17 12 23 19

配置:

hide_posts:
  enable: true
  filter: secret
  public_generators:
    - tag
    - category
    - archive
  noindex: true

Suggest better document

I thought that hidden posts would not be visible even locally (when you do hexo s), but actually they do, so I thought there was a bug with this plguin. But it seems that when I push my posts online, they do get hidden in a good way.

Example

So I suggest you write this clearly in the document, or more people might get confused. It's a feature, not a bug ;-)

Option to hide post completely

I suppose it's not to difficult to hide post completely and disallow direct access for private post.

Of cause, it will only be accessible via source file - but that's what we really mean by "private".

Otherwise, it will get into sitemap, search engines and etc. And will leak to public.

hexo g error

➜ hexo hexo g
INFO Start processing
INFO 2 posts are marked as hidden
WARN categories/index.html won't be rendered.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
TypeError: Cannot read property 'bind' of undefined
at Hexo. (/home/haoyue/文档/Web/hexo/node_modules/hexo-hide-posts/index.js:59:30)
请问是哪里有错误呢???
我的hexo 版本是4.2的

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.