1

I was having a lot of trouble getting relative links working in MODx. As soon as I made a container and put some pages one level above the root, nothing was linking correctly. Lots of missing images and broken links.

4

2 回答 2

4

NOTE: This fix apparently will break all links linking to content identifiers.

I fixed it by putting the following at the top of the web template:

<base href="[[++site_url]]" />

You have to use that. If you hardcode it, it will screw up depending on which protocol you use, http or https.

于 2012-08-10T19:00:45.830 回答
0

StingyB 的回答是正确的。这个标签应该在所有 MODX 模板的 head 部分:

`<base href="[[++site_url]]" />`

请注意,如果您有多个前端上下文,则应不缓存占位符:

`<base href="[[!++site_url]]" />`

此外,它必须是一个短标签。这将不起作用:

`<base href="[[!++site_url]]"></base>`

我不确定关于“破坏所有链接到内容标识符的链接”的评论来自哪里。这些标签在所有 MODX 安装中都是标准的。

于 2016-04-09T05:48:05.713 回答