如何在正方形 space 模板中修改 {squarespace-headers} 系统变量的输出。

How to modify output of {squarespace-headers} System Variable in square space template.

构建 Squarespace 模板时,header 元数据通常使用以下内容输出,{squarespace-headers} 看 http://developers.squarespace.com/jsont-system-variables/, 如果有人需要修改此输出,尤其是元数据,最合乎逻辑的方法是什么?

您可以使用 jQuery 轻松控制 Squarespace Meta 或由 squarespace-headers 编写的任何其他内容的输出。这将允许控制所有页面上的搜索引擎片段。在普通 Squarespace 模板中难以修改的功能。您甚至可以通过页面编辑器高级区域下的 UI 插入它。

 {squarespace-headers}
    <script   src="https://code.jquery.com/jquery-3.1.1.min.js"   integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="   crossorigin="anonymous"></script>
<script language="JavaScript">
jQuery('meta[name=description]').attr('content', 'Changed description');
jQuery('title').text('changed title');

解决此问题的最佳方法是不要使用 {squarespace-headers},简单明了。我花了很多时间试图绕过 Squarespace,最终我自己重建了 {squarespace-headers} 并删除了很多你不需要的东西。显然,不建议将其用于生产环境,但也不建议将 header 元数据修改为 JavaScript :).

您可以使用 JSON-T 完全重建 meta。