【问题标题】:How do I modify a collection's .item template in Squarespace Developer mode?如何在 Squarespace Developer 模式下修改集合的 .item 模板?
【发布时间】:2016-05-17 09:48:12
【问题描述】:

我想在开发者模式下为 Native 模板修改现有的 blog.item 模板。我想知道这是否可能,因为当我修改文件并上传回服务器时,没有识别出任何更改,正如我在 Chrome 开发人员工具中看到的那样。例如,我在 div 中添加了一个类,保存并上传,我的 FTP 管理器显示成功,但是当我在开发人员工具中检查时,该类不存在。我已经注销(FTP)并重新登录。我知道 FTP 工作正常,因为tweak.less 文件工作正常。

另外,我要特别编辑的是文章元数据。为每个帖子显示的作者、日期、喜欢。我的意思是一般来说,因为我认为这与 squarespace 系统变量有关,这可能就是为什么我似乎无法编辑它?

编辑************ 这是 blog.item 文件中的代码

<header>
            {.if title}<h1 class="entry-title" data-content-field="title" itemprop="headline">{.passthrough?}<a href="{sourceUrl}">{title} <span>&rarr;</span></a>{.or}<a href="{fullUrl}">{title}</a>{.end}</h1>{.end}
            <div class="article-meta-top">
      {.section location}<div class="location">{.if addressTitle}<a href="//maps.google.com/maps?q={mapLat},{mapLng}" target="_blank" title="View map in new window"><i class="icon-map-marker"></i>{addressTitle}</a>{.end}</div>{.end}
      <span class="date"><a href="{fullUrl}"><time class="published" datetime="{addedOn|date %F}" itemprop="datePublished">{addedOn|date %B %d, %Y}</time></a></span>
       {.section author}<span class="author"><a href="{collection.fullUrl}?author={id}" rel="author">by {displayName}</a></span>{.end}
      {.section categories}<span class="categories">in {.repeated section @}<a href="{collection.fullUrl}?category={@|url-encode}" rel="tag">{@}</a>{.alternates with}, {.end}</span>{.end}

然后我简单地想移动是在帖子页脚那里发布页眉,所以我拿了帖子页脚代码并将它移到那里。

<header>
            {.if title}<h1 class="entry-title" data-content-field="title" itemprop="headline">{.passthrough?}<a href="{sourceUrl}">{title} <span>&rarr;</span></a>{.or}<a href="{fullUrl}">{title}</a>{.end}</h1>{.end}
            <div class="article-meta">
                  <span class="date"><a href="{fullUrl}"><i class="icon-calendar"></i><time class="published" datetime="{addedOn|date %F}" itemprop="datePublished">{addedOn|date %B %d, %Y}</time></a></span>
                  {.section author}<span class="author"><span class="delimiter">/</span><a href="{collection.fullUrl}?author={id}" rel="author"><i class="icon-user"></i>{displayName}</a></span>{.end}
                  {.passthrough?}{.or}{.section sourceUrl}<span class="source"><span class="delimiter">/</span><a href="{sourceUrl}" target="_blank"><i class="icon-share"></i>Source</a></span>{.end}{.end}
                  {.section tags}<div class="tags"><i class="icon-tag"></i>{.repeated section @}<a href="{collection.fullUrl}?tag={@|url-encode}" rel="tag">{@}</a>{.alternates with}, {.end}</div>{.end}
                  {.section categories}<div class="categories"><i class="icon-bookmark"></i>{.repeated section @}<a href="{collection.fullUrl}?category={@|url-encode}" rel="tag">{@}</a>{.alternates with}, {.end}</div>{.end}

                  <div class="shareLoveButtons">
                    {@|like-button}
                    {@|social-button-inline}
                    {postItemInjectCode}
                  </div>
              </div>

我意识到这可能是特定于社区问题的,所以我不是在问如何使这项工作本身,只要它应该工作。如果不是,为什么?我在哪里可以找到这方面的文档?我查看了所有开发人员文档,但没有看到它在哪里谈论这个问题。有没有我遗漏的注释或代码注入?

【问题讨论】:

    标签: collections blogs squarespace


    【解决方案1】:

    我会先仔细检查您的 FTP 设置。其实不支持FTP协议,只有SFTP和Git支持。请务必遵循以下说明:http://developers.squarespace.com/initial-setup

    我可以通过使用 Squarespace 开发人员模式 24/7 告诉您,我从未遇到过更新无法到达服务器的问题,因此我猜测您的 SFTP 应用程序配置不正确。

    您可以先下载模板文件到您的计算机吗?从你的措辞看来,你可以做到。

    CMS 内的“开发者”页面显示什么?它应该在那里显示您的 SFTP/Git 活动。

    【讨论】:

    • “开发者”页面日志显示我已经多次上传了 blog.item 文件。是的,我也在使用 SFTP。同样,我的 tweek.less 上传工作正常。我更改了那里的任何内容或 .region 文件中的任何内容,一切都按预期工作。
    • 另外,当我从 SFTP 重新下载 blog.item 文件时,它确实显示了我所做的更改。不过,它不会影响实时页面。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多