【问题标题】:Including prefetch link in the body instead of the header在正文而不是标题中包含预取链接
【发布时间】:2021-06-01 15:21:14
【问题描述】:

我想在我的 WordPress 页面 mydomain.com/plan 中包含 page_id = 25 :

<link rel="prefetch" href="/plan-both/ " as="document">
<link rel="prefetch" href="/plan-strategy/ " as="document">
<link rel="prefetch" href="/plan-funding/ " as="document">

根据this我们需要将它包含在header.php文件中:

<?php if(is_page(25)) { ?>
    <link rel="prefetch" href="/plan-both/ " as="document">
<?php } ?>

问题:如果我包含在页面正文中,预取仍然有效吗?
这样我就可以将其包含在 WordPress 页面中,而不是编辑 header.php 文件。

【问题讨论】:

    标签: html link-prefetch


    【解决方案1】:

    是的,预取仍然有效。

    它还会稍微提高页面加载性能,因为如果页面在头部,预取将在页面加载的一半时开始。

    将它移到底部,它只会在所有重要的事情完成后才开始。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 2020-07-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多