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
feat: allow to disable content head #2142
Conversation
β Deploy Preview for nuxt-content ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
β Live Preview ready!
|
β Live Preview ready!
|
@@ -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) } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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) }
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still as a boolean?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Co-authored-by: nobkd <44443899+nobkd@users.noreply.github.com>
Thanks β€οΈ |
π Linked issue
fix #2141
β Type of change
π Description
I added a flag to disable usage of
useContentHead
in the module for advanced users.π Checklist