Don’t copy and paste the same code over and over again. Instead, create a PowerShell function and save yourself time.
Google added a section on canonicalization best practices for JavaScript to the JavaScript SEO best practices document.