1

I am wondering how I can get my Typekit font working on my Magento site. Normally it works like this.

HTML markup:

<head>
<script src="https://use.typekit.net/oti3nzu.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>
</head>

CSS markup:

html, body {
font-family: "niveau-grotesk",sans-serif;
}

So to try this with Magento I added the following to my default_head_blocks.xml inside myVendor/mytheme/Magento_Theme/layout/default_head_blocks.xml

<head>
<link src="https://use.typekit.net/oti3nzu.js"/>
<script>try{Typekit.load({ async: true });}catch(e){}</script>
</head>

I deployed my static content with bin/magento setup:static-content:deploy and if I check the sourcecode of my homepage it shows this line:

<script  type="text/javascript"  src="http://localhost:8888/website/shop/pub/static/frontend/myVendor/mytheme/en_US/https://use.typekit.net/oti3nzu.js"></script>

But it won't load the <script>. I guess I am doing it wrong but also the src to that Typekit javascript should be just "https://use.typekit.net/oti3nzu.js" right? I am stuck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.