Merge pull request #13 from netlify-templates/chore/updateReadme

Add some details to the README
This commit is contained in:
Ben Hong
2022-02-23 08:40:58 -08:00
committed by GitHub

View File

@ -1,5 +1,9 @@
# Nuxt Toolbox Template
![netlify + nuxt logo](https://res.cloudinary.com/dzkoxrsdj/image/upload/v1645592629/CleanShot_2022-02-22_at_22.47.16_2x_ltqti0.png)
This is a [NuxtJS](https://nuxtjs.org/) v2 project. It is a reference on how to integrate commonly used features within Netlify for Nuxt.js.
## Build Setup
```bash
@ -23,9 +27,12 @@ Want to deploy immediately? Click this button
[![Deploy to Netlify Button](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/netlify-templates/nuxt-toolbox)
To deploy using the Netlify cli:
(Clicking this button will create a new repo for you that looks exactly like this one, and sets that repo up immediately for deployment on Netlify)
### To deploy using the [Netlify cli](https://cli.netlify.com/):
Click the 'Use the Template' button at the top of this repo. Then install the Netlify CLI tool and run `netlify init`. Or straight from the Netlify CLI, use the `netlify sites:create-template` command in you terminal ([learn more about this command here](https://www.netlify.com/blog/create-a-site-from-a-template-using-the-netlify-cli)) to do the entire flow for you.
```bash
git clone https://github.com/netlify-templates/nuxt-toolbox
npm install netlify-cli -g # to install the Netlify CLI tool globally
netlify init # initialize a new Netlify project & deploy
```
@ -80,9 +87,9 @@ Many bots scan through webpages and try to see what pages and forms they can get
```html
<p class="hidden">
<label>
Dont fill this out if youre human: <input name="bot-field" />
</label>
<label>
Dont fill this out if youre human: <input name="bot-field" />
</label>
</p>
```
@ -92,13 +99,9 @@ communicate that this is a field not meant to be filled in.
For this to work we also need to add a `netlify-honeypot` attribute to the form element.
```html
<form
netlify
netlify-honeypot
action="/testpage"
method="post"
>
<form netlify netlify-honeypot action="/feedback" method="post"></form>
```
[See it here in the template code.](https://github.com/netlify-templates/nuxt-toolbox/blob/abb24c52738d79bcd11ff8a1bc70e0d2d250e7f1/components/feedbackForm.vue#L3)
### Forms Resources
@ -112,7 +115,6 @@ For this to work we also need to add a `netlify-honeypot` attribute to the form
In the [`netlify.toml`](./netlify.toml) configuration file there is an example of how to implement redirects. Redirects can be used to do many things from redirecting Single Page Apps more predictably, redirecting based on country/language to leveraging On-Demand Builders for [Distributed Persistant Rendering](https://www.netlify.com/blog/2021/04/14/distributed-persistent-rendering-a-new-jamstack-approach-for-faster-builds/).
In the [`netlify.toml`](./netlify.toml) configuration file there is an example of how to implement redirects. Redirects can be used to do many things from redirecting Single Page Apps more predictably, redirecting based on country/language to leveraging On-Demand Builders for [Distributed Persistant Rendering](https://www.netlify.com/blog/2021/04/14/distributed-persistent-rendering-a-new-jamstack-approach-for-faster-builds/).
In the example we'll be using redirects to have a shorter endpoint to Netlify functions. By default, you call a Netlify function when requesting a path like `https://yoursite.netlify.com/.netlify/functions/functionName`. Instead, we'll redirect all calls from a path including `/api` to call on the Netlify functions. So the path will be `https://yoursite.netlify.com/api/functionName`, a lot easier to remember too.
@ -169,3 +171,10 @@ There is quite a bit you can do with these functions, so here are some additiona
- [What are Background Functions](https://www.netlify.com/blog/2021/01/07/what-are-background-functions/)
- [Netlify Functions - Examples](https://functions.netlify.com/examples/)
- [Using esbuild as your bundler for new ECMAScript Features](https://www.netlify.com/blog/2021/04/02/modern-faster-netlify-functions/)
## I want moar!
If you want to discover more Netlify features via this template, here's a couple of things you could try:
- Add a Netlify plugin, either via [the UI](https://app.netlify.com/plugins) or [`netlify.toml`](https://docs.netlify.com/configure-builds/build-plugins/). For example, why not try the `A11y` plugin to run some accessibility testing on your site!
- [Create environment variables using the CLI](https://www.netlify.com/blog/2021/07/12/managing-environment-variables-from-your-terminal-with-netlify-cli/) to store secret tokens (e.g. API key), and use them in the Netlify function to fetch data from your favorite API.