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

[gnoweb] add metadata to md content #3333

Open
alexiscolin opened this issue Dec 13, 2024 · 0 comments
Open

[gnoweb] add metadata to md content #3333

alexiscolin opened this issue Dec 13, 2024 · 0 comments
Assignees
Labels
🌍 gnoweb Issues & PRs related to gnoweb and render

Comments

@alexiscolin
Copy link
Member

Feature Proposal: Add Metadata Support in Realm for gnoweb Customization

There is a need to enhance gnoweb customization capabilities by allowing the addition of metadata like meta-title, description, and other relevant information directly within the realm. This enhancement would significantly improve the flexibility and functionality of gnoweb by enabling customization of the <head> section of the generated webpages for example.

Proposed Solution

Introduce a method to embed metadata within realm files to allow for greater customization of gnoweb. This can be achieved with different approaches such as:

  1. Front-Matter in Markdown Files:

    • Utilize front-matter syntax to include metadata at the beginning of Markdown files.
    • Example:
      ---
      meta-title: "Custom Page Title"
      description: "This is a custom description for the page."
      ---
      
      # Your Markdown Content
    • Advantages:
      • Compatible with Goldmark, our Go-based Markdown renderer, via existing plugins.
      • Adheres to a standard that remains invisible on many Markdown platforms (e.g., HackMD does not display front-matter).
  2. Comments Within Markdown Files:

    • Embed metadata within comments to keep it hidden from the rendered output.
    • Example:
      <!--
      meta-title: "Custom Page Title"
      description: "This is a custom description for the page."
      -->
      
      # Your Markdown Content
      • ⚠️ However, this second approach is not the best IMO since we disabled html within realm but also because it is less structured.

Benefits

  • Enhanced Customization: Allows for specifying page-specific metadata, which can be injected into the <head> section of gnoweb pages, improving SEO and user experience.
  • Compatibility: Front-matter is a widely adopted standard, ensuring compatibility with existing tools and platforms (not visible in HackMD, for example).
  • Non-Intrusive: Metadata remains hidden from the end-users, maintaining the cleanliness of the rendered content.

Implementation Considerations

Would be good to brainstorm about this in this issue but in any way, I'll add a PR to experiment the first approach once gnoweb refactor (#3195) will be merged.

  • Front-Matter Parsing: Leverage existing Goldmark plugins to parse front-matter without additional overhead.
  • Validation: Implement validation to ensure that the metadata fields are correctly formatted and used.
  • Documentation: Update the Gnoweb documentation to include guidelines on how to use metadata in realm files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌍 gnoweb Issues & PRs related to gnoweb and render
Projects
Status: Triage
Development

No branches or pull requests

1 participant