如何在Sitecore SXA元数据部分设计中使用使用令牌?

问题描述

我在Sitecore SXA元数据部分设计中使用了HTML代码段,以在生成的HTML的头部添加一些链接

enter image description here

此HTML是:

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/sxa-umbrella-webcomponents/sxa-umbrella-webcomponents.css" />
<script type="module" src="https://unpkg.com/[email protected]/dist/sxa-umbrella-webcomponents/sxa-umbrella-webcomponents.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected]/dist/sxa-umbrella-webcomponents/sxa-umbrella-webcomponents.js"></script>

但是我想使用例如令牌来配置基本路径,例如:

<link rel="stylesheet" href="$WebComponentsBasePath/sxa-umbrella-webcomponents.css" />
<script type="module" src="$WebComponentsBasePath/sxa-umbrella-webcomponents.esm.js"></script>
<script nomodule src="$WebComponentsBasePath/sxa-umbrella-webcomponents.js"></script>

令牌设置为:"https://unpkg.com/[email protected]/dist/sxa-umbrella-webcomponents

但是令牌替换在HTML代码段中不起作用。

关于如何使此基本路径可用于元数据部分设计的任何想法,这样我就可以为我的开发环境和生产环境进行不同的配置,并有可能轻松切换生产中的基本路径以前滚版本或回滚基于配置的基本路径使用的文件的版本?

解决方法

您是否考虑为这3个文件创建一个主题并将其包含在您的网站主题中?