Skip to content

Commit 7660e32

Browse files
authoredMar 5, 2023
feat: Add Nuxt SEO composables (#35)
* Remove old snippets #34 * Add new composables #34 * Add README for new composables #34
1 parent 267bca6 commit 7660e32

File tree

2 files changed

+35
-51
lines changed

2 files changed

+35
-51
lines changed
 

‎README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,19 @@ These snippets were made to speed up Vue 3 development. With it you can write bo
120120

121121
### Nuxt Script
122122

123-
| Snippet | Purpose |
124-
| ----------------------- | -------------------------------------------- |
125-
| `nfetch` | `useFetch` composable |
126-
| `nfetch-lazy` | `useLazyFetch` composable |
127-
| `nasyncdata` | `useAsyncData` composable |
128-
| `nasyncdata-lazy` | `useLazyAsyncData` composable |
129-
| `nhead` | `useHead` composable |
130-
| `nhead-description` | `useHead` composable with description |
131-
| `nhead-template` | `useHead` composable with title template |
132-
| `npagemeta` | `definePageMeta` composable |
133-
| `npagemeta-description` | `definePageMeta` composable with description |
134-
| `nplugin` | Base code for Nuxt plugin |
135-
| `nmiddleware` | Base code for Nuxt middleware |
136-
| `nserverroute` | Base code for Nuxt server route |
123+
| Snippet | Purpose |
124+
| ---------------------- | ---------------------------------------- |
125+
| `nfetch` | `useFetch` composable |
126+
| `nfetch-lazy` | `useLazyFetch` composable |
127+
| `nasyncdata` | `useAsyncData` composable |
128+
| `nasyncdata-lazy` | `useLazyAsyncData` composable |
129+
| `nseo` | `useSeoMeta` composable |
130+
| `nseo-template` | `useSeoMeta` composable - Template |
131+
| `nseo-server` | `useServerSeoMeta` composable |
132+
| `nseo-server-template` | `useServerSeoMeta` composable - Template |
133+
| `nplugin` | Base code for Nuxt plugin |
134+
| `nmiddleware` | Base code for Nuxt middleware |
135+
| `nserverroute` | Base code for Nuxt server route |
137136

138137
### Histoire
139138

‎snippets/nuxt/nuxt-script.code-snippets

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,43 @@
2727
],
2828
"description": "Nuxt useLazyAsyncData composable"
2929
},
30-
"Nuxt useHead": {
31-
"prefix": "nhead",
30+
"Nuxt useSeoMeta": {
31+
"prefix": "nseo",
3232
"body": [
33-
"useHead({",
34-
"\ttitle: ${1:pageTitle},",
33+
"useSeoMeta({",
34+
"\ttitle: ${1:pageTitle}",
35+
"\tdescription: ${2:pageDescription}",
3536
"})"
3637
],
37-
"description": "Nuxt useHead composable"
38+
"description": "Nuxt useSeoMeta composable"
3839
},
39-
"Nuxt useHead with description": {
40-
"prefix": "nhead-description",
40+
"Nuxt useSeoMeta - Template": {
41+
"prefix": "nseo-template",
4142
"body": [
42-
"useHead({",
43-
"\ttitle: ${1:pageTitle},",
44-
"\tmeta: [",
45-
"\t\t{ name: 'description', content: ${2:pageDescription} },",
46-
"\t],",
43+
"useSeoMeta({",
44+
"\ttitleTemplate: '%s | ${0}'",
4745
"})"
4846
],
49-
"description": "Nuxt useHead composable with description"
47+
"description": "Nuxt useSeoMeta composable with title template"
5048
},
51-
"Nuxt useHead - Title template": {
52-
"prefix": "nhead-template",
49+
"Nuxt useServerSeoMeta": {
50+
"prefix": "nseo-server",
5351
"body": [
54-
"useHead({",
55-
"\ttitleTemplate: (titleChunk) => {",
56-
"\t\treturn titleChunk ? `\\${titleChunk} - ${1:siteTitle}` : '${1:siteTitle}'",
57-
"\t}",
52+
"useServerSeoMeta({",
53+
"\ttitle: ${1:pageTitle}",
54+
"\tdescription: ${2:pageDescription}",
5855
"})"
5956
],
60-
"description": "Nuxt useHead composable with title template"
57+
"description": "Nuxt useServerSeoMeta composable"
6158
},
62-
"Nuxt definePageMeta": {
63-
"prefix": "npagemeta",
59+
"Nuxt useServerSeoMeta - Template": {
60+
"prefix": "nseo-server-template",
6461
"body": [
65-
"definePageMeta({",
66-
"\ttitle: '${1:pageTitle}',",
62+
"useServerSeoMeta({",
63+
"\ttitleTemplate: '%s | ${0}'",
6764
"})"
6865
],
69-
"description": "Nuxt definePageMeta composable"
70-
},
71-
"Nuxt definePageMeta with description": {
72-
"prefix": "npagemeta-description",
73-
"body": [
74-
"definePageMeta({",
75-
"\ttitle: '${1:pageTitle}',",
76-
"\tmeta: [",
77-
"\t\t{ name: 'description', content: '${2:pageDescription}' },",
78-
"\t],",
79-
"})"
80-
],
81-
"description": "Nuxt definePageMeta composable with description"
66+
"description": "Nuxt useServerSeoMeta composable with title template"
8267
},
8368
"Nuxt define plugin": {
8469
"prefix": "nplugin",

0 commit comments

Comments
 (0)
Please sign in to comment.