hexo-theme-next icon indicating copy to clipboard operation
hexo-theme-next copied to clipboard

Add webmanifest generator

Open wherewhere opened this issue 1 month ago • 5 comments

PR Checklist

  • [x] The changes have been tested (for bug fixes / features).
  • [ ] Docs in NexT website have been added / updated (for features).

PR Type

  • [ ] Bugfix.
  • [x] Feature.
  • [ ] Improvement.
  • [ ] Code style update (e.g. formatting, linting).
  • [ ] Refactoring (no changes to functionality and APIs).
  • [ ] Documentation.
  • [ ] Translation.
  • [ ] Other... Please describe:

What is the new behavior?

Add a generator for webmanifest so that we can define it in _config.next.yml.

How to use?

In NexT _config.yml:

# Generate webmanifest file for PWA. Path can be customized in `favicon.android_manifest`.
webmanifest:
  enable: true
  lang: zh-CN
  name: 魔法薇ㄦ的书馆
  short_name: wherlog
  description: 铺路尚未成功,同志仍需努力!
  categories:
    - blogs
    - news
    - tools
  id: ./
  start_url: ./
  display: standalone
  orientation: any
  background_color: '#ffffff'
  theme_color: '#222222'
  shortcuts:
    - name: 首页
      url: ./
      icons:
        - src: >-
            https://github.com/user-attachments/assets/82d0bd87-3548-4b3a-a05d-1a02ba2f7766
          sizes: any
          type: image/svg+xml
        - src: >-
            https://github.com/user-attachments/assets/cd6ae091-7016-4d32-994c-0e819f8abc9d
          sizes: 96x96
          type: image/png
    - name: 关于
      url: ./about
      icons:
        - src: >-
            https://github.com/user-attachments/assets/4b3e59c7-83ba-4d19-8fef-37f58d121bf3
          sizes: any
          type: image/svg+xml
        - src: >-
            https://github.com/user-attachments/assets/19fa3741-4262-42e6-9d06-745c79fd324d
          sizes: 96x96
          type: image/png
    - name: 标签
      url: ./tags
      icons:
        - src: >-
            https://github.com/user-attachments/assets/3beeceb2-8422-491d-bbbf-a1aa489f2a92
          sizes: any
          type: image/svg+xml
        - src: >-
            https://github.com/user-attachments/assets/5ef886eb-54b9-4d59-975c-13c051131772
          sizes: 96x96
          type: image/png
    - name: 分类
      url: ./categories
      icons:
        - src: >-
            https://github.com/user-attachments/assets/eaf31404-f274-487a-802c-6855d444a90e
          sizes: any
          type: image/svg+xml
        - src: >-
            https://github.com/user-attachments/assets/3ceee83b-b775-4415-b9b2-2c3965b290d4
          sizes: 96x96
          type: image/png
    - name: 归档
      url: ./archives
      icons:
        - src: >-
            https://github.com/user-attachments/assets/9e5b9545-72b5-4a1f-983e-d872cf80214b
          sizes: any
          type: image/svg+xml
        - src: >-
            https://github.com/user-attachments/assets/a7316c02-6cd7-45fc-b571-f68d630f813a
          sizes: 96x96
          type: image/png
    - name: 小工具
      url: ./tools
      icons:
        - src: >-
            https://github.com/user-attachments/assets/4e7bafc5-d41d-4c98-ba07-312199e3af32
          sizes: any
          type: image/svg+xml
        - src: >-
            https://github.com/user-attachments/assets/88829d67-203d-4b76-bb34-be7c3099f54c
          sizes: 96x96
          type: image/png
  icons:
    - src: >-
        https://github.com/user-attachments/assets/b66057ec-daeb-4dbe-8a26-04b510c7b2b3
      sizes: any
      type: image/svg+xml
      purpose: maskable
    - src: >-
        https://github.com/user-attachments/assets/2ecc7072-a4c4-40e4-9cd3-43299538b436
      sizes: 144x144
      type: image/png
      purpose: maskable
    - src: >-
        https://github.com/user-attachments/assets/8469e1db-78b3-4f5b-a962-767d2f73b7ad
      sizes: 192x192
      type: image/png
      purpose: maskable
    - src: >-
        https://github.com/user-attachments/assets/fab8ce15-fcf0-4e4a-95d9-27b8b4906dc0
      sizes: 512x512
      type: image/png
      purpose: maskable
    - src: >-
        https://github.com/user-attachments/assets/cdb36b7f-318f-4c27-b302-17ace91cf67d
      sizes: any
      type: image/svg+xml
    - src: >-
        https://github.com/user-attachments/assets/d1923d74-f33a-4858-83cf-dcea9aa95a2a
      sizes: 144x144
      type: image/png
    - src: >-
        https://github.com/user-attachments/assets/fc94a772-b4e6-4706-b3c1-d541f0c43ae2
      sizes: 192x192
      type: image/png
    - src: >-
        https://github.com/user-attachments/assets/769b1b2c-6e57-4b26-864b-9dd5633a28e8
      sizes: 512x512
      type: image/png
  screenshots:
    - src: >-
        https://github.com/user-attachments/assets/ecef883b-eecd-4c68-bf28-c6cb852c8ec2
      sizes: 2736x1824
      type: image/png
      form_factor: wide
      label: 首页
    - src: >-
        https://github.com/user-attachments/assets/18391ebc-2b3e-4439-aceb-79ab2f4cd45a
      sizes: 2736x1824
      type: image/png
      form_factor: wide
      label: 关于
    - src: >-
        https://github.com/user-attachments/assets/79a6add3-0fbd-476f-9eb6-496741268b22
      sizes: 1080x2160
      type: image/png
      label: 首页
    - src: >-
        https://github.com/user-attachments/assets/cff15429-3299-491a-ae05-6eac6011f947
      sizes: 1080x2160
      type: image/png
      label: 关于

wherewhere avatar Nov 07 '25 05:11 wherewhere

This pull request contains changes to the configuration file. Please make sure the documentation in NexT website is changed or added. Please edit relevant source files here: https://github.com/next-theme/theme-next-docs/tree/master/source/docs and create a pull request with the changes here: https://github.com/next-theme/theme-next-docs/pulls

github-actions[bot] avatar Nov 07 '25 05:11 github-actions[bot]

Pull Request Test Coverage Report for Build 19158819593

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.451%

Totals Coverage Status
Change from base Build 19063816877: 0.0%
Covered Lines: 400
Relevant Lines: 405

💛 - Coveralls

coveralls avatar Nov 07 '25 05:11 coveralls

@wherewhere Can you make it a Hexo plugin to support webmanifest? This feature can be used with any Hexo theme, not only NexT, so I think it's not necessary to add it to NexT config file.

stevenjoezhang avatar Nov 07 '25 09:11 stevenjoezhang

But it can collaborate with favicon.android_manifest. And this function is too small that not enough to be a standalone plugin...

wherewhere avatar Nov 07 '25 13:11 wherewhere

Maybe we can add more collaborations like generate shortcuts by menu.

wherewhere avatar Nov 07 '25 14:11 wherewhere