Skip to content

Inconsistent Head Configuration in VitePress #4166

@admin8756

Description

@admin8756

Describe the bug

Hello VitePress team,

I have encountered an issue with the configuration of the head element in VitePress. It seems that the current setup for dynamically setting meta tags using gray-matte is not standard, and there appears to be validation that restricts certain elements from being added to the head section.

Steps to Reproduce:

  1. Attempt to dynamically set meta tags in the head using gray-matte.
  2. Observe that the configuration is not fully compliant with standard practices.
  3. Notice potential restrictions or validation preventing other elements from being added.

Expected Behavior:

  • The head configuration should follow standard practices, allowing for a flexible and compliant setup.
  • It should be possible to dynamically add any necessary meta tags or other elements without encountering validation issues.

Actual Behavior:

  • The current setup does not seem to follow the standard, and there are restrictions or validations in place that may limit the addition of other elements to the head.

Proposed Solution:

  • Review and update the head configuration to ensure it adheres to standard web practices.
  • Allow for dynamic setting of meta tags and other elements using gray-matte or similar approaches without unnecessary restrictions.

Additional Information:

I'm not entirely sure if this issue affects all elements, but it does seem to impact the ability to add meta tags dynamically. A review of the validation logic might be necessary to ensure flexibility in head configuration.

Thank you for your attention to this matter.


This message clearly describes the issue, provides context, and suggests a potential solution, which should help the maintainers of the project understand and address the bug.

image
image
image

Reproduction

head:

    • meta
    • name: description
      content: 本文介绍了console在JavaScript中的使用方法和技巧,包括状态类方法、功能类方法、性能分析、表格输出、记时、时间戳、堆栈追踪等。同时,也探讨了.这些技巧可以帮助开发者更有效地利用,console进行调试工作,提高开发效率。
    • meta
    • name: keywords
      content: JavaScript
      stackblitz

Expected behavior

head:
meta:
- name: description
content: 本文介绍了console在JavaScript中的使用方法和技巧,包括状态类方法、功能类方法、性能分析、表格输出、记时、时间戳、堆栈追踪等。同时,也探讨了.这些技巧可以帮助开发者更有效地利用,console进行调试工作,提高开发效率。
- name: keywords
content: JavaScript

System Info

win , pnpm ,vitpress 1.3.4

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions