Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve next/script documentation #31062

Closed
2 of 4 tasks
housseindjirdeh opened this issue Nov 5, 2021 · 3 comments
Closed
2 of 4 tasks

Improve next/script documentation #31062

housseindjirdeh opened this issue Nov 5, 2021 · 3 comments
Assignees
Labels
Script (next/script) Related to Next.js Script Optimization.

Comments

@housseindjirdeh
Copy link
Collaborator

housseindjirdeh commented Nov 5, 2021

Describe the feature you'd like to request

There has been feedback that the usage of next/script can be difficult to understand for Next.js developers looking to optimize loading of third-party scripts. This is a multi-step proposal to improve how the Script component is explained in the documentation.

Describe the solution you'd like

  • Expand the Script Component page in the core documentation to (Expands next/script documentation #31063):
    • Include additional information on the different loading strategies available and when to use them
    • Explain other useful capabilities of next/script in more detail (onLoad, inline scripts, etc...)
  • Add a next/script page to the API reference documentation (Expands next/script documentation #31063)
  • Include "recipes" in the documentation to show how to use the Script component to load some of the most popular third-party scripts (GTM, Google Analytics, etc...)
  • Include an example of how to use the Script component in nextjs.org/learn

Describe alternatives you've considered

N/A

@housseindjirdeh housseindjirdeh self-assigned this Nov 5, 2021
kodiakhq bot pushed a commit that referenced this issue Nov 8, 2021
This PR does the following to partially address #31062:

- Expands the [Script Component](https://nextjs.org/docs/basic-features/script) page in the core documentation
- Adds a `next/script` API reference page
@lafiosca
Copy link

Along these lines I think it would be nice to have clarity on certain behaviors. For example: what happens if you are using props as values in the dangerous innerHTML for a Script component? Will it re-render and run the code again? What happens if you need multiple scripts with the same strategy to load in a specific order? Etc.

@timneutkens timneutkens added Script (next/script) Related to Next.js Script Optimization. type: documentation labels Nov 17, 2021
natew pushed a commit to natew/next.js that referenced this issue Feb 16, 2022
This PR does the following to partially address vercel#31062:

- Expands the [Script Component](https://nextjs.org/docs/basic-features/script) page in the core documentation
- Adds a `next/script` API reference page
@manovotny
Copy link
Contributor

The Next.js Learn course now has a Third-Party JavaScript section that educates on next/script usage. There are also several examples for next/script usage, including with-google-analytics in the Next/.js repo.

Calling this ok for now.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Script (next/script) Related to Next.js Script Optimization.
Projects
None yet
Development

No branches or pull requests

4 participants