kitajchuk / node-squarespace-server

DEPRECATED! A local Squarespace development server in node.js.
MIT License
186 stars 26 forks source link

Index loads in browser with "undefined" and nothing else #165

Closed jathayde closed 8 years ago

jathayde commented 8 years ago

Pages cache completely, less processing working (or at least not throwing errors), reloading the page checks the cache value in the server output. Same behavior in Chrome and Safari.

Have deleted .sqs-cache and reloaded, the error persists.

screen shot 2016-02-15 at 5 26 26 pm
kitajchuk commented 8 years ago

Hmm. This is a tough one to track down sometimes. I've seen it when I accidentally try to apply a block partial that doesn't exist. What's your template look like you're trying to render?

jathayde commented 8 years ago

Thanks for taking a look @kitajchuk.

I’m using the out-of-the-box developer theme from SquareSpace. Had to comment out one grid-buster include in the less file, and define one missing variable (also on the less side).

The site.region file is as such:

<!doctype html>
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="initial-scale=1">

    <!--Include sqs scripts, meta tags, and user content from the code injection tab.-->
    {squarespace-headers}
    <!-- H&Co Fonts for Sensetra -->
    <link rel="stylesheet" type="text/css" href="https://cloud.typography.com/672732/803282/css/fonts.css" />
  </head>
  <body id="{squarespace.page-id}" class="{squarespace.page-classes}">

    <!-- <div class="container"> -->

      <header id="header" class="header">
        <!--Site title or logo.-->
        {.section website}

          <h1 class="site-title" data-content-field="site-title">
            <a href="/">
              {.section logoImageUrl}
               <img class="logo" src="{logoImageUrl}?format=original" alt="{siteTitle}" />
              {.or}
                {siteTitle}
              {.end}
            </a>
          </h1>

          <!--Site tagline.-->
          {.section siteTagLine}
            <p class="site-tagline">{@}</p>
          {.end}

        {.end}

        <!--Main navigation.-->
        <squarespace:navigation navigationId="mainNav" template="navigation" />
      </header>

      <!--Content injection point.-->
      <main id="content" class="content" role="main" data-content-field="main-content">
       {squarespace.main-content}
      </main>

      <!--Footer with open block field.-->
      <footer id="footer" class="footer">
        <squarespace:block-field id="footerBlocks" columns="12" />
      </footer>

    <!-- </div> -->

    <!--Combo and minify the scripts when you're not logged in.-->
    <squarespace:script src="site.js" combo="{.if authenticatedAccount}false{.or}true{.end}" />

    <!--Injection point for tracking scripts and user content from the code injection tab.-->
    {squarespace-footers}

  </body>
</html>

The only change there from default being the addition of the H&Co. font stylesheet call.

kitajchuk commented 8 years ago

When you encounter the undefined rendering issue - do you have any files in .sqs-cache that cached with undefined as the contents of that file? If so, which ones?

jathayde commented 8 years ago

There's two files there:

page-homepage.html page-homepage.son

They're both fully rendered pages and everything looks like it's there. "Undefined" shows up twice in page-homepage.html but in both cases it's conditional statements or part of a javascript function. Not rendered content.

jathayde commented 8 years ago

FWIW, loading up that page-homepage.html as a url after localhost gives the following content under the proper nav from the site:

We couldn't find the page you were looking for. This is either because:

* There is an error in the URL entered into your web browser. Please check the URL and try again.
* The page you are looking for has been moved or deleted.

You can return to our homepage by clicking here, or you can try searching for the content you are seeking by clicking here.

Looking in the log, while that URL exists in the cache, it doesn't like it one bit:

> sqs-log Error requesting page json from Squarespace with middleware => <p>We couldn't find the page you were looking for. This is either because:</p><ul><li>There is an error in the URL entered into your web browser. Please check the URL and try again.</li><li>The page you are looking for has been moved or deleted.</li></ul><p>You can return to our homepage by <a href="/">clicking here</a>, or you can try searching for the content you are seeking by <a href="javascript:Y.Squarespace.Singletons.Search.show();">clicking here</a>.</p>
> sqs-log Error requesting page => <p>We couldn't find the page you were looking for. This is either because:</p><ul><li>There is an error in the URL entered into your web browser. Please check the URL and try again.</li><li>The page you are looking for has been moved or deleted.</li></ul><p>You can return to our homepage by <a href="/">clicking here</a>, or you can try searching for the content you are seeking by <a href="javascript:Y.Squarespace.Singletons.Search.show();">clicking here</a>.</p>
> sqs-log Request responded with server code 404 for => `/page-homepage.html`

Any content that's actually on the site returns as undefined when you click on it or add the path to the URL. By hitting that url it adds two according files to the cache (html and json). Both read as okay HTML.

jathayde commented 8 years ago

Okay, so the template was having lots of other issues as well. I turned off development mode, turned it back on, re-pulled the initial git repo, and it works. I'm going to chalk this up to something wonky that happened on the SqSp side as it's not replicable. Thanks for taking a look at it.