Skip to content
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

Automatically adding html, body tag on manifest, serviceworker files #840

Closed
3 of 11 tasks
gracefullight opened this issue Apr 17, 2019 · 13 comments
Closed
3 of 11 tasks

Comments

@gracefullight
Copy link

gracefullight commented Apr 17, 2019

I agree and want to create new issue


Expected behavior

localhost:4000/manifest.json

{
    "name": "Blog",
     ...
}

Actual behavior

localhost:4000/manfiest.json

<html><body>{ "name": "Blog" ... }</body></html>

Steps to reproduce the behavior

  1. enable exturl: true (on /themes/next/_config.yml)
  2. create manifest.json (on /source/manifest.json)
  3. set favicon.android_manfiest /manifest.json (on /themes/next/_config.yml)

Node.js and NPM Information

v11.13.0
6.7.0

Package dependencies Information

{
  "name": "blog",
  "version": "1.0.0",
  "private": true,
  "hexo": {
    "version": "3.8.0"
  },
  "scripts": {
    "clean": "hexo clean && rimraf public/"
  },
  "dependencies": {
    "hexo": "^3.8.0",
    "hexo-all-minifier": "^0.5.3",
    "hexo-autonofollow": "^1.0.1",
    "hexo-deployer-git": "^1.0.0",
    "hexo-generator-amp": "^3.0.19",
    "hexo-generator-archive": "^0.1.5",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-feed": "^1.2.2",
    "hexo-generator-index": "^0.2.1",
    "hexo-generator-json-content": "^4.1.3",
    "hexo-generator-searchdb": "^1.0.8",
    "hexo-generator-seo-friendly-sitemap": "0.0.25",
    "hexo-generator-tag": "^0.2.0",
    "hexo-helper-qrcode": "^1.0.2",
    "hexo-renderer-ejs": "^0.3.1",
    "hexo-renderer-less": "^1.0.0",
    "hexo-renderer-markdown-it-plus": "^1.0.4",
    "hexo-renderer-stylus": "^0.3.3",
    "hexo-renderer-swig": "^1.1.0",
    "hexo-server": "^0.3.3",
    "hexo-symbols-count-time": "^0.4.4",
    "hexo-tag-leaflet": "^1.0.4",
    "workbox-cli": "^3.6.3"
  },
  "devDependencies": {
    "rimraf": "^2.6.3"
  }
}

Hexo Information

Hexo version

hexo: 3.8.0
hexo-cli: 1.1.0
os: Darwin 18.5.0 darwin x64
node: 11.13.0
v8: 7.0.276.38-node.18
uv: 1.27.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 67
nghttp2: 1.34.0
napi: 4
llhttp: 1.1.1
http_parser: 2.8.0
openssl: 1.1.1b
cldr: 34.0
icu: 63.1
tz: 2018e
unicode: 11.0

Hexo Configuration

NexT Information

NexT Version:

  • Latest Master branch
  • Latest Release version
  • Old version

NexT Scheme:

  • All schemes
  • Muse
  • Mist
  • Pisces
  • Gemini

NexT Configuration:

Other Information

@welcome
Copy link

welcome bot commented Apr 17, 2019

Thanks for opening this issue, maintainers will get back to you as soon as possible!

@jiangtj
Copy link
Member

jiangtj commented Apr 17, 2019

You should config hexo _config.yml as following:

skip_render:
  - manfiest.json

@jiangtj jiangtj added Hexo and removed Bug labels Apr 17, 2019
@gracefullight
Copy link
Author

@jiangtj Skip rendering other files? (like serviceworker..) How about adding xmlMode option?

@jiangtj
Copy link
Member

jiangtj commented Apr 17, 2019

xmlMode?What's it? 😂

@gracefullight
Copy link
Author

@jiangtj I think this bug caused by cheerio

@jiangtj
Copy link
Member

jiangtj commented Apr 17, 2019

So? If disable exturl, it work well?

@gracefullight
Copy link
Author

@jiangtj Yes, works fine.

@jiangtj jiangtj added Bug and removed Hexo labels Apr 17, 2019
@jiangtj
Copy link
Member

jiangtj commented Apr 17, 2019

Orz, may need modify exturl filter...
Like this https://github.com/hexojs/hexo-filter-lqip/blob/a31d8d732e60bc3da92c77dc26b5296bfdf9655b/lqip/index.js#L32-L47
Set hexo.route

GitHub
A Hexo plugins which helps to introduce low quality image placeholders to the theme - hexojs/hexo-filter-lqip

@stevenjoezhang
Copy link
Contributor

I can’t reproduce this bug... exturl uses after_post_render filter, which should only work on html files, not json.

@jiangtj
Copy link
Member

jiangtj commented Apr 28, 2019

@stevenjoezhang Yes, it seems not wrapper with <html><body>. But it rendered files that is not .html suffix.

image
image
image

@gracefullight Can you test it with added this. And I don't know why your json file wrappered with <html><body>?
image

@gracefullight
Copy link
Author

gracefullight commented Apr 28, 2019

@stevenjoezhang yes, after_post_render is a hook for post only, but it's weird json files in that time.
(https://github.com/hexojs/hexo/blob/2ed17cd105768df379dad8bbbe4df30964fe8f2d/lib/hexo/post.js#L285)

I try to reproduce in this time, but it fails. 😨
If it happens again next time, I'll write more details.

Thanks for your time. @jiangtj

GitHub
A fast, simple & powerful blog framework, powered by Node.js. - hexojs/hexo

@stevenjoezhang
Copy link
Contributor

The loading of cheerio has been optimized in #1042. You can help to confirm whether the problem has been solved

@stevenjoezhang
Copy link
Contributor

See also hexojs/hexo#3315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants