Add @stefanobartoletti/nuxt-social-share dependency to your project:
npx nuxi@latest module add nuxt-social-share
pnpm i -D @stefanobartoletti/nuxt-social-share
yarn add -D @stefanobartoletti/nuxt-social-share
npm install -D @stefanobartoletti/nuxt-social-share
Nuxi should have already added @stefanobartoletti/nuxt-social-share to the modules section of nuxt.config. If not, add it manually:
export default defineNuxtConfig({
modules: [
'@stefanobartoletti/nuxt-social-share'
],
})
Add your website base URL to the module options:
export default defineNuxtConfig({
// module options
socialShare: {
baseUrl: 'https://www.yoursite.com' // required!
// other optional module options
}
})
Use the <SocialShare> component wherever you need it in your app:
<SocialShare network="facebook" :styled="true" />