Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
nuxt-head-ex
Advanced tools
Implements `useHeadEx()` composable to automatically propagate title and description to social media compatible meta tags.
Weekly downloads
Readme
Implements useHeadEx()
composable to automatically propagate title and description to social media compatible meta
tags.
yarn add nuxt-head-ex
...and add the module to your nuxt.config.ts
:
modules: ['nuxt-head-ex'],
Configuration example (see types.ts
for more information / parameters):
export default defineNuxtConfig({
modules: ['nuxt-head-ex'],
headExtra: {
extra: 'My Sweet Website', // appended to titles
separator: '•', // used to separate title components / extra
defaults: {
// you can use {{fullPath}} to pass the path to a dynamic image generator
socialImageURL: 'https://l422y.com/images/share.png?path={{fullPath}}',
description: 'Senior full-stack engineer and creative technologist with over 20 years’ experience and a focus in software, interactive and web development.'
}
}
})
You can override the title rendering function altogether:
<script setup>
const app = useNuxtApp()
app.$headExtra.renderTitle = function ({ title, subtitle, section, separator, extra }) {
let renderedTitle = `${section && section?.length > 0 ? ` ${separator} ${section}` : ''}${extra && extra.length > 0 ? (title ? ` ${separator} ` : '') + extra : ''}`
if (title) {
renderedTitle = `⚡️ ${title}${renderedTitle}`
} else {
title = renderedTitle
}
return renderedTitle
}
</script>
Usage:
<script setup>
useHeadEx({
title: `${project?.title}`,
subtitle,
section: `PROJECTS`,
description: `${excerpt}`
})
</script>
Accessing updated values:
const nuxt = useNuxtApp()
const sectionTitle = useState('sectionTitle')
// set up a callback
nuxt.$headExtra.callback = (headObj) => { /*...*/
}
// ...or use the `headExtra:update` nuxt hook
nuxt.hook('headExtra:update', (headObj) => {
sectionTitle = headObj.meta.find(v => v.name === 'clean:section')
})
Accessing the currently used input reflectively:
app.vue
<template>
<div v-if="hExValues?.section">
hExValues.section = "{{ hExValues.section }}"
</div>
<NuxtPage/>
</template>
<script setup>
const hExValues = useState('headExtraValues')
</script>
pages/test.vue
<template>
<section id="testing">
Now we're cooking with gas!
</section>
</template>
<script setup>
useHeadEx({
title: 'Testing!',
section: 'Testing Section'
})
</script>
npm run dev:prepare
to generate type stubs.npm run dev
to start playground in development mode.Made with 💚 by Larry Williamson / @l422y
FAQs
Implements `useHeadEx()` composable to automatically propagate title and description to social media compatible meta tags.
The npm package nuxt-head-ex receives a total of 0 weekly downloads. As such, nuxt-head-ex popularity was classified as not popular.
We found that nuxt-head-ex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.