-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix(postPermalinkFilter): permalink_defaults should not overwrite values #3926
Conversation
1 similar comment
@@ -6,18 +6,19 @@ let permalink; | |||
|
|||
function postPermalinkFilter(data) { | |||
const { config } = this; | |||
const { id, _id, slug, title, date } = data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified on a test blog.
for (const key of keys2) { | ||
if (Object.prototype.hasOwnProperty.call(meta, key)) continue; | ||
|
||
meta[key] = config.permalink_defaults[key]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try deepMerge()
to see if Maximum call stack size exceeded
still occurs.
Update
According to the documents of lodash.defaults
:
Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored.
Yeah, it is my mistake to replace lodash.defaults
with Object.assign
.
What does it do?
permalink_defaults
option does not work correctly from 4.1.0.According https://hexo.io/docs/permalinks, set
_config.yml
asand the URL will be:
Compare v4.0.0 and v4.1.0,
I found the related change is e0f2478#diff-dbb03cb234189f8e709e7c5f9921aa67L45 (#3790)
If change to
it causes "Maximum call stack size exceeded" error, so use for loop to copy values.
How to test
Pull request tasks