Git Product home page Git Product logo

hexo-generator-feed's Introduction

hexo-generator-feed

Build Status NPM version Coverage Status

Generate Atom 1.0 or RSS 2.0 feed.

Install

npm install hexo-generator-feed --save
  • Hexo 4+: 2.x
  • Hexo 3: 1.x
  • Hexo 2: 0.x

Use

In the front-matter of your post, you can optionally add a description, intro or excerpt setting to write a summary for the post. Otherwise the summary will default to the excerpt or the first 140 characters of the post.

Options

You can configure this plugin in _config.yml.

feed:
  enable: true
  type: atom
  path: atom.xml
  limit: 20
  hub:
  content:
  content_limit: 140
  content_limit_delim: ' '
  order_by: -date
  icon: icon.png
  autodiscovery: true
  template:
  • enable - Enables or disables this plugin. Enabled by default.
  • type - Feed type. atom or rss2. Specify ['atom', 'rss2'] to output both types. (Default: atom)
    • Example:
    feed:
      # Generate atom feed
      type: atom
    
      # Generate both atom and rss2 feeds
      type:
        - atom
        - rss2
      path:
        - atom.xml
        - rss2.xml
  • path - Feed path. When both types are specified, path must follow the order of type value. (Default: atom.xml/rss2.xml)
  • limit - Maximum number of posts in the feed (Use 0 or false to show all posts)
  • hub - URL of the PubSubHubbub hubs (Leave it empty if you don't use it)
  • content - (optional) set to 'true' to include the contents of the entire post in the feed.
  • content_limit - (optional) Default length of post content used in summary. Only used, if content setting is false and no custom post description present.
  • content_limit_delim - (optional) If content_limit is used to shorten post contents, only cut at the last occurrence of this delimiter before reaching the character limit. Not used by default.
  • order_by - Feed order-by. (Default: -date)
  • icon - (optional) Custom feed icon. Defaults to a gravatar of email specified in the main config.
  • autodiscovery - Add feed autodiscovery. (Default: true)
    • Many themes already offer this feature, so you may also need to adjust the theme's config if you wish to disable it.
  • template - Custom template path(s). This file will be used to generate feed xml file, see the default templates: atom.xml and rss2.xml.
    • It is possible to specify just one custom template, even when this plugin is configured to output both feed types,
    # (Optional) Exclude custom template from being copied into public/ folder
    # Alternatively, you could also prepend an underscore to its filename, e.g. _custom.xml
    # https://hexo.io/docs/configuration#Include-Exclude-Files-or-Folders
    exclude:
      - 'custom.xml'
    feed:
      type:
        - atom
        - rss2
      template:
        - ./source/custom.xml
      # atom will be generated using custom.xml
      # rss2 will be generated using the default template instead

hexo-generator-feed's People

Contributors

ahaasler avatar bebraw avatar curbengh avatar daiyi avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar dorayo avatar f213 avatar gejiawen avatar ghw avatar h404bi avatar jjgod avatar kritner avatar lzjqsdd avatar nmaggioni avatar noahdragon avatar nt3rp avatar opengg avatar ryanhanwu avatar segayuu avatar sehajyang avatar seoh avatar stevenjoezhang avatar sukkaw avatar tomap avatar tommy351 avatar uiolee avatar yoshinorin avatar zbicin 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hexo-generator-feed's Issues

hexo如何让RSS全文输出?

你好,我在文章中加了标签后,RSS输出只有摘要,怎样设置可以全文输出?(PS:我不想去掉摘要标签)

A Tip: set the `url` config if your site is put in a subdirectory.

firstly, I got a error:

TypeError [ERR_INVALID_URL]: Invalid URL: http://
    at onParseError (internal/url.js:241:17)
    at new URL (internal/url.js:319:5)
    at new URL (internal/url.js:316:22)
    at cache.apply (/Users/xxxxx/Code/Blog/node_modules/hexo-generator-feed/node_modules/hexo-util/lib/url_for.js:35:18)
    at Cache.apply (/Users/xxxxx/Code/Blog/node_modules/hexo-generator-feed/node_modules/hexo-util/lib/cache.js:27:46)
    at Hexo.urlForHelper (/Users/xxxxx/Code/Blog/node_modules/hexo-generator-feed/node_modules/hexo-util/lib/url_for.js:30:16)
    at Hexo.autodiscoveryInject (/Users/xxxxx/Code/Blog/node_modules/hexo-generator-feed/lib/autodiscovery.js:14:64)
    at Hexo.tryCatcher (/Users/xxxxx/Code/Blog/node_modules/bluebird/js/release/util.js:16:23)
    at Hexo.<anonymous> (/Users/xxxxx/Code/Blog/node_modules/bluebird/js/release/method.js:15:34)

I finally found the reason: I need to set this config item. (in your root folder file _config.yml)

## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: '/blog/'

Error: Invalid character

The generated atom xml is reported as invalid when the post content contains special chars like '😱'

Publish the package

Hello,

I wanted to use the icon customization functionnality, but couldn't because the currently published package on NPM (v1.2.2) is 2 years old, and therefore does not match the master branch at all.

Could somebody publish this pckage so that we can use all the new functionnalities is provides?

Config to turnoff excerpt in RSS?

Sometime I turn on excerpt for index/catalog page for readability, but still want full text output for RSS reader users.

Could you please add a rss config to output full-text in force?

I use excerpt cmd below:

<!-- more -->

Deprecation warning for Node v6

When running hexo with this package in Node 6.2, I'm getting this warning:

node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.

==== JS stack trace =========================================

Security context: 0x34871afc9e59 <JS Object>#0#
    1: .node [module.js:568] [pc=0x34aefd8a0184] (this=0x10d26bfe67b9 <an Object with map 0x1e493e818161>#1#,module=0x319fc44ab799 <a Module with map 0x1e493e818739>#2#,filename=0x319fc44ab709 <String[115]: /myblog/node_modules/hexo-generator-feed/node_modules/fsevents/build/Release/fse.node>)
    2: load [module.js:~449] [pc=0x34aefdb1a2f6] (this=0x319fc44ab799 <a Module with map 0x1e493e818739>#2#,filename=0x319fc44ab709 <String[115]: /myblog/node_modules/hexo-generator-feed/node_modules/fsevents/build/Release/fse.node>)
    3: tryModuleLoad(aka tryModuleLoad) [module.js:417] [pc=0x34aefd83921d] (this=0x34871af04189 <undefined>,module=0x319fc44ab799 <a Module with map 0x1e493e818739>#2#,filename=0x319fc44ab709 <String[115]: /myblog/node_modules/hexo-generator-feed/node_modules/fsevents/build/Release/fse 1: v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)
 2: fse::FSEvents::Initialize(v8::Local<v8::Object>)
 3: node::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)
 4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))
 5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>)
 6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)
 7: 0x34aefd70961b
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.

Note that everything seems to work correctly, but still it's not optimal to see this every time.

Why the input is not proper UTF-8?

I have got a error when click the RSS button in my blog:

This page contains the following errors:

error on line 898 at column 35: Input is not proper UTF-8, indicate encoding !
Bytes: 0xE4 0xBB 0x8D 0xE6

How to fix it? thanks..

Bad links in RSS

I change root path in _config.yml and all links in RSS feed are broken - there is no root path in post.permalink property.

Option to remove generator from output atom.xml

I would like to remove the <generator uri="http://hexo.io/">Hexo</generator> tag from my atom.xml file. I'm using version 2.0.0 of hexo-generator-feed.

The generator tag is not required per https://validator.w3.org/feed/docs/atom.html#optionalFeedElements

I believe it adds unnecessary bytes to the payload. I also believe it reveals details about my site that I would rather not share.

I looked through the options and there is no option to remove the tag via options.

I also looked for an option to replace the template with my own template. That option doesn't exist either. The option to replace the template would be useful for a wide variety of use cases and is probably the best solution. For an example of a template option, see https://github.com/hexojs/hexo-generator-sitemap

出现错误

安装hexo-generator-feed的时候回显如下:
npm WARN optional dep failed, continuing [email protected]
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[email protected] node_modules/hexo-generator-feed
├── [email protected]
└── [email protected] ([email protected], [email protected])
之后在_config.yml中配置如下:
plugins:

  • hexo-generator-feed
    使用hexo -g生成的时候出现错误:
    2016-07-15 12-52-52
    2016-07-15 12-53-19

hexo version: v3.2.2

生成的atom.xml配置文件提示编码错误

qq 20161208083821

之前貌似都没有问题的,今天去看突然就有问题了,什么鬼。

[root@iZ28i253je0Z blog.ansheng.me]# cat package.json 
{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.2.2"
  },
  "dependencies": {
    "hexo": "^3.2.0",
    "hexo-autonofollow": "^1.0.1",
    "hexo-generator-archive": "^0.1.4",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-feed": "^1.2.0",
    "hexo-generator-index": "^0.2.0",
    "hexo-generator-json-content": "^3.0.1",
    "hexo-generator-search": "^1.0.2",
    "hexo-generator-sitemap": "^1.1.2",
    "hexo-generator-tag": "^0.2.0",
    "hexo-renderer-ejs": "^0.2.0",
    "hexo-renderer-less": "^0.2.0",
    "hexo-renderer-marked": "^0.2.10",
    "hexo-renderer-stylus": "^0.3.1",
    "hexo-server": "^0.2.0"
  }
}

Allowable `order_by` values

Hi,

Haven't gotten my feet wet with hexo yet, so apologies if this should be an obvious answer, but wanted to get a high level overview of what was possible and didn't find it with some looking around...

For the allowable order_by option values, is this in reference to https://hexo.io/docs/variables.html#Page-Variables ? If so, I guess the - at the beginning means descending order? If so, where is the API for posts.sort?

Thanks!

Spacing issue in content:encoded field of rss2

I have a post content written in markdown like this

This is a first line of text
then I start a new line of text.

When rss2 file is created the content:encoded contains:

This is a first line of textthen I start a new line of text.

Note missing space between the first and the second line.

In my case I fixed it by using a custom template that instead of

post.content | noControlChars | safe

renders

post.content | replace("\n", " ") | noControlChars | safe

What do you think about making it a default behavior of noControlChars filter though?

Is there a plan to support 3.2.2?

Thanks very much, this is a very nice plugin for hexo.

But when I upgrade the hexo from 3.1.x to 3.2.2, this plugin crashes when I try to generate the website.


My _config.yml:

...yml
plugins:
- hexo-generator-feed
...
feed:
    type: atom
    path:atom.xml
    limit: 20
...

Version:

hexo: 3.2.2
hexo-cli: 1.0.2
os: Darwin 16.0.0 darwin x64
http_parser: 2.6.0
node: 5.4.0
v8: 4.6.85.31
uv: 1.8.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 47
openssl: 1.0.2e
{ 'hexo-site': '0.0.0',
  npm: '3.10.7',
  ares: '1.10.1-DEV',
  http_parser: '2.6.0',
  icu: '56.1',
  modules: '47',
  node: '5.4.0',
  openssl: '1.0.2e',
  uv: '1.8.0',
  v8: '4.6.85.31',
  zlib: '1.2.8' }

Error when executor: hexo g with [email protected]:

INFO  Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path) [Line 7, Column 23]
  Error: Unable to call `the return value of (posts["first"])["updated"]["toISOString"]`, which is undefined or falsey
    at Object.exports.prettifyError (/Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/lib.js:34:15)
    at /Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/environment.js:485:31
    at root [as rootRenderFunc] (eval at <anonymous> (/Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/environment.js:564:24), <anonymous>:161:3)
    at Obj.extend.render (/Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/environment.js:478:15)
    at Hexo.module.exports (/Users/Jacksgong/code/github/blog/node_modules/hexo-generator-feed/lib/generator.js:28:22)
    at Hexo.tryCatcher (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/util.js:16:23)
    at Hexo.<anonymous> (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/method.js:15:34)
    at /Users/Jacksgong/code/github/blog/node_modules/hexo/lib/hexo/index.js:337:24
    at tryCatcher (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/util.js:16:23)
    at MappingPromiseArray._promiseFulfilled (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:57:38)
    at MappingPromiseArray.PromiseArray._iterate (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise_array.js:113:31)
    at MappingPromiseArray.init (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise_array.js:77:10)
    at new MappingPromiseArray (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:25:10)
    at map (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:152:12)
    at Function.Promise.map (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:160:12)
    at /Users/Jacksgong/code/github/blog/node_modules/hexo/lib/hexo/index.js:334:20
    at tryCatcher (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:502:31)
    at Promise._settlePromise (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:559:18)
    at Promise._settlePromise0 (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:604:10)
    at Promise._settlePromises (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:683:18)
    at Async._drainQueue (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/async.js:138:16)
FATAL (unknown path) [Line 7, Column 23]
  Error: Unable to call `the return value of (posts["first"])["updated"]["toISOString"]`, which is undefined or falsey
Template render error: (unknown path) [Line 7, Column 23]
  Error: Unable to call `the return value of (posts["first"])["updated"]["toISOString"]`, which is undefined or falsey
    at Object.exports.prettifyError (/Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/lib.js:34:15)
    at /Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/environment.js:485:31
    at root [as rootRenderFunc] (eval at <anonymous> (/Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/environment.js:564:24), <anonymous>:161:3)
    at Obj.extend.render (/Users/Jacksgong/code/github/blog/node_modules/nunjucks/src/environment.js:478:15)
    at Hexo.module.exports (/Users/Jacksgong/code/github/blog/node_modules/hexo-generator-feed/lib/generator.js:28:22)
    at Hexo.tryCatcher (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/util.js:16:23)
    at Hexo.<anonymous> (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/method.js:15:34)
    at /Users/Jacksgong/code/github/blog/node_modules/hexo/lib/hexo/index.js:337:24
    at tryCatcher (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/util.js:16:23)
    at MappingPromiseArray._promiseFulfilled (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:57:38)
    at MappingPromiseArray.PromiseArray._iterate (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise_array.js:113:31)
    at MappingPromiseArray.init (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise_array.js:77:10)
    at new MappingPromiseArray (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:25:10)
    at map (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:152:12)
    at Function.Promise.map (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/map.js:160:12)
    at /Users/Jacksgong/code/github/blog/node_modules/hexo/lib/hexo/index.js:334:20
    at tryCatcher (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:502:31)
    at Promise._settlePromise (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:559:18)
    at Promise._settlePromise0 (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:604:10)
    at Promise._settlePromises (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/promise.js:683:18)
    at Async._drainQueue (/Users/Jacksgong/code/github/blog/node_modules/bluebird/js/release/async.js:138:16)

JSON feed

The JSON feed spec was announced yesterday and I am looking to add this to my Hexo site. I'm already using this plugin for RSS and my question is this:

Is this something that'd be useful as part of this plugin (I'm willing to do the work and open a PR) or would it be better for me to fork and create a version specific to JSON feed?

Thanks

[error] Cannot read property 'feed' of undefined

After I install hexo-generator-feed and add configures in _config.yml...I run the 'hexo server',It throw the error "[error] 23:16:12.492 TypeError: Cannot read property 'feed' of undefined"...the error show: the config is undefined in Line16 of lib/generator.js.I cannot find any solutions.May I ask u tell me why,thks
the config in _config.yml is append after,just like some aritcals show:


plugins:

  • hexo-generator-feed

feed:
type: atom
path: atom.xml
limit: 20


Convert image absolute/relative src link with full URL

Is it possible to convert image src link without hostname with the full URL? The image doesn't display on aggregator.

I have an image like this : <img src="/root/to/my/image.jpg" /> and I want to convert with <img src="https://my.blog.tld/root/to/my/image.jpg" />

I have temporarily modified the script to add the hostname...

ejs.filters.cdata = function(str){
  str = str.replace(/src="+\//g, 'src="https://my.blog.tld/');
  return str ? '<![CDATA[' + str + ']]>' : '';
};

Thanks,

TypeError: config.type.toLowerCase is not a function

'Generate atom feed' will work:

feed:
  type: atom
  path: atom.xml
  limit: 100

'Generate both atom and rss2' feeds not work

feed:
  type: # Generate both atom and rss2 feeds
    - atom
    - rss2
  path:
    - atom.xml
    - rss2.xml

error info

$ hexo g
(node:9376) [DEP0061] DeprecationWarning: fs.SyncWriteStream is deprecated.
ERROR Plugin load failed: hexo-generator-feed
TypeError: config.type.toLowerCase is not a function
    at H:\Hexo\node_modules\hexo-generator-feed\index.js:16:26
    at fs.readFile.then.script (H:\Hexo\node_modules\hexo\lib\hexo\index.js:232:12)
    at tryCatcher (H:\Hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (H:\Hexo\node_modules\bluebird\js\release\promise.js:517:31)
    at Promise._settlePromise (H:\Hexo\node_modules\bluebird\js\release\promise.js:574:18)
    at Promise._settlePromise0 (H:\Hexo\node_modules\bluebird\js\release\promise.js:619:10)
    at Promise._settlePromises (H:\Hexo\node_modules\bluebird\js\release\promise.js:699:18)
    at Promise._fulfill (H:\Hexo\node_modules\bluebird\js\release\promise.js:643:18)
    at Promise._resolveCallback (H:\Hexo\node_modules\bluebird\js\release\promise.js:437:57)
    at Promise._settlePromiseFromHandler (H:\Hexo\node_modules\bluebird\js\release\promise.js:529:17)
    at Promise._settlePromise (H:\Hexo\node_modules\bluebird\js\release\promise.js:574:18)
    at Promise._settlePromise0 (H:\Hexo\node_modules\bluebird\js\release\promise.js:619:10)
    at Promise._settlePromises (H:\Hexo\node_modules\bluebird\js\release\promise.js:699:18)
    at Promise._fulfill (H:\Hexo\node_modules\bluebird\js\release\promise.js:643:18)
    at H:\Hexo\node_modules\bluebird\js\release\nodeback.js:42:21
    at H:\Hexo\node_modules\graceful-fs\graceful-fs.js:90:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

生成不同category的rss

如果生成不同category的rss更好,那样就可以写几个类别给不同的人订阅,并不是所有的人都对所有类别感兴趣

W3C feed validation issue

I'm not sure if this was introduced in the 2.1 release or not, but I know my feed used to validate, and now it does not.

image

In the above the first error complains that https://www.w3.org/2005/Atom is not a valid namespace, but http://www.w3.org/2005/Atom is. I can find another hexo generated site served via https that has the correct http URL, so I don't think it's a matter of my site being served securely.

Here is an example of the full W3C validation:
https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fblog.kritner.com%2Fatom.xml

Could this have changed in the recent release?

RSS生成的atom.xml乱码问题

Description (描述)

貌似属于编码问题。
我安装了feed插件,配置文件按照README.md设置,产生乱码。
版本"hexo-generator-feed": "^1.1.0",
环境:windows7/10(mac下测试无误)

Expected behavior (预期行为)

Actual behavior (实际行为)

TypeError: path.substring is not a function

After I intalled the package, I ran hexo g, then it raised the errors:

Unhandled rejection TypeError: path.substring is not a function
    at Object.urlForHelper (/home/dennis/hexo/blog/node_modules/hexo/lib/plugins/helper/url_for.js:9:31)
    at wrapper (/home/dennis/hexo/blog/node_modules/hexo/node_modules/lodash/lodash.js:4941:19)
    at Object.eval [as tpl] (eval at precompile (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:498:13), <anonymous>:195:119)
    at compiled (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:619:18)
    at Object.eval [as tpl] (eval at precompile (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:498:13), <anonymous>:320:125)
    at compiled (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:619:18)
    at Theme._View.View._compiled (/home/dennis/hexo/blog/node_modules/hexo/lib/theme/view.js:127:30)
    at Theme._View.View.View.render (/home/dennis/hexo/blog/node_modules/hexo/lib/theme/view.js:29:15)
    at /home/dennis/hexo/blog/node_modules/hexo/lib/hexo/index.js:387:25
    at tryCatcher (/home/dennis/hexo/blog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at /home/dennis/hexo/blog/node_modules/hexo/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (/home/dennis/hexo/blog/node_modules/hexo/lib/hexo/router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:457:10)
    at resume_ (_stream_readable.js:933:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Unhandled rejection TypeError: path.substring is not a function
    at Object.urlForHelper (/home/dennis/hexo/blog/node_modules/hexo/lib/plugins/helper/url_for.js:9:31)
    at wrapper (/home/dennis/hexo/blog/node_modules/hexo/node_modules/lodash/lodash.js:4941:19)
    at Object.eval [as tpl] (eval at precompile (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:498:13), <anonymous>:195:119)
    at compiled (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:619:18)
    at Object.eval [as tpl] (eval at precompile (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:498:13), <anonymous>:320:125)
    at compiled (/home/dennis/hexo/blog/node_modules/hexo/node_modules/swig/lib/swig.js:619:18)
    at Theme._View.View._compiled (/home/dennis/hexo/blog/node_modules/hexo/lib/theme/view.js:127:30)
    at Theme._View.View.View.render (/home/dennis/hexo/blog/node_modules/hexo/lib/theme/view.js:29:15)
    at /home/dennis/hexo/blog/node_modules/hexo/lib/hexo/index.js:387:25
    at tryCatcher (/home/dennis/hexo/blog/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at /home/dennis/hexo/blog/node_modules/hexo/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (/home/dennis/hexo/blog/node_modules/hexo/lib/hexo/router.js:134:3)
    at RouteStream.Readable.read (_stream_readable.js:457:10)
    at resume_ (_stream_readable.js:933:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

My hexo version:

hexo: 3.2.2
hexo-cli: 2.0.0
os: Linux 4.15.0-38-generic linux x64
http_parser: 2.8.0
node: 10.16.0
v8: 6.8.275.32-node.52
uv: 1.28.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 64
nghttp2: 1.34.0
napi: 4
openssl: 1.1.1b
icu: 64.2
unicode: 12.1
cldr: 35.1
tz: 2019a

feed_tag() helper

The idea of bring up a hexo built-in RSS autodiscovery helper comes from #115. I notice that there is already a feed_tag() helper: https://github.com/hexojs/hexo/blob/master/lib/plugins/helper/feed_tag.js

The problem is:

  • The hexo's built-in feed_tag() doesn't support type
  • The helper still requires manually setup.

We should bring up a helper that output autodiscovery tag automatically based on the config. Since it will be a helper maintained by us, it only requires theme developer to put something like <%- feed_autodiscovery() %> in the layout without worrying about the Breaking Changes of the plugins.

cc @AlynxZhou @stevenjoezhang

RSS has stopped updating

不知为何 我的plugin停止自动更新了 最后一次更新是在:1-14号
安装配置都没有问题 请问如何解决?

Writing back `path` to config breaks theme compatibility when path is a string.

aac8fbb

This commit rewrite path of this module back into hexo.config.feed, and refer to README.md, hexo.config.feed.path can be (and most time is just) a string rather an array.

I can understand that it is easier to handle via making path an array in code, but for themes assuming it is a string, and telling users to set a string in config, it is confusing that a string in _config.yml becomes an array. Plugins should not edit config, config is written by users, so it should keep the same as _config.yml in most cases.

I spent 2 hours with some errors showing that path.startsWith is not a function from url_for, because I just pass hexo.config.feed.path, which is a string in _config.yml, I only find this after I decide to inject a console.log into url_for.

Please either remove those lines, or at least add some developing API docs in your README.md, to let theme authors know no matter which type you write in _config.yml, hexo.config.feed.path will always be an array.

安装feed插件,出现模板渲染错误!!!

描述

我在安装feed插件之后,在生成文件'hexo g',之后提示我模板渲染错误的问题,这让我无法生成文件。但是我在package.json中删除掉‘"hexo-generator-feed": "^1.2.2",’,之后我再次生成文件则可以正常生成,请问这是什么问题。

错误显示

tim 20180624135903

配置

tim 20180624140043
电脑系统:windows10 ×64
博客主题:next

Failed on Node 5.6

All the infomation is here : https://travis-ci.org/Xuanwo/xuanwo.github.io/builds/111965103

With:

FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path) [Line 7, Column 23]
  Error: Unable to call `the return value of (posts["first"])["updated"]["toISOStrin"]`, which is undefined or falsey
    at Object.exports.withPrettyErrors (/home/travis/build/Xuanwo/xuanwo.github.io/node_modules/hexo-generator-feed/node_modules/nunjucks/src/lib.js:35:17)

twitterfeed无法识别feed地址

提示如下:
Your feed might be empty or missing publish dates or GUIDs. A feed needs to contain publish dates or GUIDs in order to work with twitterfeed, see help
看到atom.xml页面中日期的格式是这样的:
2015-01-18T16:00:00.000Z
2015-01-19T16:34:38.000Z
难道跟中间那个T有关从而无法识别出date?

The generated atom.xml contains Control Characters which prevents the atom.xml from being recognised correctly

I'm using hexo 3.2.0 and hexo-generator-feed 1.1.0.

I get an error opening the generated atom.xml: error on line 41 at column 428: PCDATA invalid Char value 16

I find that most characters whose char value is less than 32(decimal) is a Control Character and should not be put in the atom.xml, see this and this. The most useful info from here is:

When you put utf-8 encoded strings in a XML document you should remember that not all utf-8 valid > chars are accepted in a XML document http://www.w3.org/TR/REC-xml/#charsets
So you should strip away the unwanted chars, else you’ll have an XML fatal parsing error

So I suppose if those characters can be removed from atom.xml when we generate it, I will no longer get the error.

By the way, this issue should be caused by the same reason.

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.