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

fix(theme-docs): remove redundant header #722

Merged
merged 2 commits into from
Jan 22, 2021

Conversation

NozomuIkuta
Copy link
Collaborator

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

It is explained in documentation that category in front-matter is optional. However, theme docs renders the category header in AppNav component regardless of existence of it.

  • If category is completely not defined in front-matter, theme docs renders undefined as a uppercase text.
  • If category is set as an empty string in front-matter, theme docs renders an empty p element with margin-bottom.

Reproduction Link (CodeSandbox)

With my PR, category in front-matter is validated in content:file:beforeInsert hook, and is set as an empty string if it's falsy or not a string. Coercion to an empty string is for its type to match that described in documentation.

In addition, if category is an empty string (i.e. falsy), now AppNav component doesn't render the category header (the p element).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

I tested my changes in local by yarn link the modified package.

@atinux atinux added the theme-v1 Concerns @nuxt/content-theme-docs label Jan 18, 2021 — with Volta.net
@benjamincanac benjamincanac merged commit e85daf0 into nuxt:dev Jan 22, 2021
@benjamincanac
Copy link
Member

Thanks @NozomuIkuta 🙂

@NozomuIkuta NozomuIkuta deleted the fix/redundant-category-header branch February 9, 2021 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme-v1 Concerns @nuxt/content-theme-docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants