Skip to content

Commit

Permalink
Update Docs: Guides “nuxt” (#6608)
Browse files Browse the repository at this point in the history
  • Loading branch information
audacia-sam-markey authored and martinjagodic committed Oct 17, 2023
1 parent 3fb4dce commit 12811ca
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion website/content/docs/nuxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ npm run dev

### Add the Decap CMS files to Nuxt

For nuxt 3 apps and above use the \`public/\` folder instead of \`/static\` which is for nuxt 2.

In the `static/` directory, create a new directory `admin/`. Inside that directory you'll create two files, your `index.html` and a `config.yml`. Per the [Decap CMS documentation](/docs/add-to-your-site/), we'll set the content of `static/admin/index.html` to the following:

```html
Expand Down Expand Up @@ -107,6 +109,8 @@ Now you can go ahead and deploy to Netlify. Go to your Netlify dashboard and cli

You've already added the Netlify Identity widget to our `admin/index.html`. The next thing to do is add the Netlify Identity widget to our site's index page. In `pages/index.vue`, we can add the following to the page `<script>` tag:

#### Nuxt 2 apps:

```javascript
export default {
head() {
Expand All @@ -117,6 +121,20 @@ export default {
};
```

#### Nuxt 3 apps:

```javascript
<script setup>
useHead({
  script: [
    { src: "https://identity.netlify.com/v1/netlify-identity-widget.js" },
  ],
});
</script>
```

Once you've added this, make sure to push your changes to GitHub!

*More on adding `<script>` tags to `<head>` [here](https://nuxtjs.org/faq/#local-settings).*
Expand Down Expand Up @@ -266,4 +284,4 @@ export default {
};
```

To see the generated site, navigate to name-of-your-website.netlify.app/blog
To see the generated site, navigate to name-of-your-website.netlify.app/blog

0 comments on commit 12811ca

Please sign in to comment.