我在Netlify上开发一个基于GatabyJS的网站https://www.evooq.ch/careers/。我想添加一个Google Hire脚本以显示职位空缺列表。
这是Google提供的代码(我已经用一个普通的html文件测试过它是有效的)。
我将“class”更改为“className”,我尝试将脚本标签直接添加到组件中,这样做会随机显示工作列表,但更多时候不会显示任何内容。
我还尝试将脚本标签添加到gatsby-ssr.js中,如下所示...
我尝试在ssr文件中使用setHeadComponents、setPreBodyComponents和setPostBodyComponents。我还尝试了不同组合的async和defer。
这是Google提供的代码(我已经用一个普通的html文件测试过它是有效的)。
<div class="hire-jobs"></div>
<script id="hire-embed-loader" async defer src="https://hire.withgoogle.com/s/embed/hire-jobs.js?company=evooqch"></script>
我将“class”更改为“className”,我尝试将脚本标签直接添加到组件中,这样做会随机显示工作列表,但更多时候不会显示任何内容。
我还尝试将脚本标签添加到gatsby-ssr.js中,如下所示...
import React from "react";
export function onRenderBody({ setHeadComponents }) {
setHeadComponents([
<script
id="hire-embed-loader"
src="https://hire.withgoogle.com/s/embed/hire-jobs.js?company=evooqch"
/>
]);
}
我尝试在ssr文件中使用setHeadComponents、setPreBodyComponents和setPostBodyComponents。我还尝试了不同组合的async和defer。