Skip to content

Conversation

SukkaW
Copy link
Member

@SukkaW SukkaW commented Oct 21, 2019

What does it do?

This is a continuation of #3669

How to test

git clone -b meta_generator https://github.com/sukkaw/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@SukkaW SukkaW requested a review from curbengh October 21, 2019 05:47
@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 97.269% when pulling c5e4a45 on SukkaW:meta_generator-helper into 52adf39 on hexojs:master.

@curbengh
Copy link
Contributor

curbengh commented Oct 26, 2019

What's the benefit of having this (to the theme) instead of meta_generator: true|false?

@SukkaW
Copy link
Member Author

SukkaW commented Oct 26, 2019

@curbengh
If a theme want to add meta_generator tag, this helper will be helpful. With theme using this helper, the meta_generator filter can be disabled and speed up generation.

@curbengh
Copy link
Contributor

Fair enough.

Then,

const hexoGeneratorTag = `<meta name="generator" content="Hexo ${this.version}">`;

can be refactored to const hexoGeneratorTag = metaGeneratorTag(); to de-duplicate.

@SukkaW
Copy link
Member Author

SukkaW commented Oct 26, 2019

@curbengh Since it is only a simple string, I see no necessary replacing it with a function.

@SukkaW SukkaW merged commit b9ad605 into hexojs:master Oct 27, 2019
SukkaW referenced this pull request Nov 16, 2019
* refactor(meta_generator): drop cheerio

* fix(meta_generator): append to </title>

* test(meta_generator): remove irrelevant head tag test

* test(render): disable meta_generator

* fix(meta_generator): do not append if there is existing tag,

regardless the value of 'content'

* test(open_generator): test existing generator tag

* test(meta_generator): tag should be added only once

Previous commit only works on post, not page
This reverts commit 325f303.
thom4parisot pushed a commit to thom4parisot/hexo that referenced this pull request Jan 17, 2020
* feat: add meta_generator helper
* test: add meta_generator helper
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

Successfully merging this pull request may close these issues.

3 participants