title: why does window.location.pathname work in one function but not another?
body: <p>I am trying to check my page slug in a function and I get an error</p>
  <pre><code>Server Error
  ReferenceError: window is not defined
  </code></pre>
  <p>I have another function that it works great in...</p>
  <pre><code>function Page() {
  
  const thisPage = window.location.pathname.slice(1); 
  console.log(thisPage);
  ....
  </code></pre>
  <p>Today I am trying to use it here below, but I get the error above</p>
  <pre><code>export default function Page() {
      
  const thisPage = window.location.pathname.slice(1); 
  console.log(thisPage);
  </code></pre>
  <p>Why does the code work in one function but not the other?</p>