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

feat: allow to disable content head #2142

Merged
merged 9 commits into from Aug 23, 2023

Conversation

Barbapapazes
Copy link
Contributor

@Barbapapazes Barbapapazes commented Jul 5, 2023

πŸ”— Linked issue

fix #2141

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

I added a flag to disable usage of useContentHead in the module for advanced users.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify
Copy link

netlify bot commented Jul 5, 2023

βœ… Deploy Preview for nuxt-content ready!

Name Link
πŸ”¨ Latest commit 0e39984
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt-content/deploys/64e61a02642c2700075e83d2
😎 Deploy Preview https://deploy-preview-2142--nuxt-content.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nuxt-studio
Copy link

nuxt-studio bot commented Jul 5, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
content Edit on Studio β†—οΈŽ View Live Preview 0e39984

@nuxt-studio
Copy link

nuxt-studio bot commented Jul 5, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
content Edit on Studio β†—οΈŽ View Live Preview 59b383b

src/module.ts Outdated Show resolved Hide resolved
@@ -94,12 +97,12 @@ export default defineComponent({
// Default slot
default: slots?.default
? ({ data, refresh, isPartial }: any) => {
if (head) { useContentHead(data) }
if (head && enableContentHead) { useContentHead(data) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is a better approach if we use enableContentHead as default value head props and let users overwrite it in special cases if they want to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this comment. Could you explain we use enableContentHead as default value head props.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component accepts a head props with true as default, we can set the default to undefined then assing enableContentHead to it if it's undefined

maybe this snippet describes it better

const shouldInjectContentHead = props.head === undefined ? enableContentHead : props.head

if (shouldInjectContentHead) { useContentHead(data) }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okkk, I understand. Will update the PR.

src/module.ts Outdated
@@ -746,6 +754,8 @@ interface ModulePublicRuntimeConfig {

navigation: ModuleOptions['navigation']

enableContentHead: ModuleOptions['enableContentHead']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe contentHeadMeta or contentMetaTags, instead of enableContentHead. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still as a boolean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes as a boolean, or maybe simpler contentHead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like documentDriven option, users can set it to false

docs/content/4.api/3.configuration.md Outdated Show resolved Hide resolved
Co-authored-by: nobkd <44443899+nobkd@users.noreply.github.com>
@farnabaz farnabaz merged commit 89862d7 into nuxt:main Aug 23, 2023
7 checks passed
@farnabaz
Copy link
Member

Thanks ❀️

@farnabaz farnabaz mentioned this pull request Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to disable automatic usage of useContentHead
3 participants