-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Writing back path
to config breaks theme compatibility when path is a string.
#115
Comments
As part of #100, it is now possible for this plugin to output both rss2 and atom. feed:
type:
- atom
- rss2 Thus, hexojs/hexo-theme-unit-test#25 includes a code snippet for theme to be compatible with
A theme shouldn't expect a plugin's config to be consistent. If a theme wants to use a plugin's config, it is the theme's responsibility to check for compatibility and add the relevant workaround to the theme, not the other way around. Besides, this plugin is not expected to be used as some kind of API. A theme using config of this plugin is outside the use case of this plugin. The config of this plugin is never intended to be used by a theme nor other plugins.
The current readme already shows it is possible for
This plugin needs to write back to user config to ensure consistency. When it is not consistent, it can break this feature especially this line. |
The EJS snippet as mentioned in hexojs/hexo-theme-unit-test#25, this is how a theme can be made compatible with #100,
|
Duplicate of #112 |
It's better to check if array or string, but for some template engine it's not so easy to call Anyway, thank you for your work 👍 |
Since the config format of In fact, this version of |
aac8fbb
This commit rewrite
path
of this module back intohexo.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 fromurl_for
, because I just passhexo.config.feed.path
, which is a string in_config.yml
, I only find this after I decide to inject aconsole.log
intourl_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.The text was updated successfully, but these errors were encountered: