title: How to get page URL or hostname in NextJs Project?
body: <p>I want to get the page's full URL or site hostname like the image below on Static Site Generator.</p>
  <p>I will try with <code>window.location.hostname</code>, but it doesn't work.</p>
  <p>The error: <strong>window not defined.</strong></p>
  <p><a href="https://i.stack.imgur.com/c5zvx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/c5zvx.png" alt="enter image description here" /></a></p>