Magento - How to change the font throughout the site using typekit?

Magento - How to change the font throughout the site using typekit?

August 10, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - How to change the font throughout the site using typekit?

Changing Font Throughout Your Magento Site Using Typekit

Hello developers! Today, I’m going to guide you through a common scenario where you want to apply a custom font from Typekit across your entire Magento site. This is especially useful if you’re looking to differentiate your store’s visual identity.

Understanding the Problem

You have a beautiful font picked out on Typekit that isn’t part of Magento’s default font family. You’ve copied the required JavaScript code, but you’re not sure where to place it so it applies site-wide without needing manual insertion on every page.

The Solution: Theme Configuration and Head Patching

In Magento 1.x, the best practice is to utilize your custom theme’s configuration and head patching capabilities. Here’s a step-by-step guide:

Step 1: Enable Your Custom Theme

First, ensure your custom theme (mytheme in this case) is activated as the default theme for both frontend and backend.

In your Magento admin panel:

  • Navigate to System > Configuration
  • Click on General > Design
  • Set Theme to mytheme

Step 2: Create a New Theme Layout XML File

Next, you’ll create a new layout XML file in your custom theme’s directory. This file will contain the Typekit JavaScript code.

Create a new file named local.xml inside:

app/design/frontend/default/mytheme/layout

If the layout folder doesn’t exist, create it first.

Step 3: Add the Typekit Scripts to local.xml

Open your newly created local.xml file and paste the following content:

<layout version="1.0">
    <reference name="head">
        <block type="core/text" as="typekit_js">
             <action method="setText">
                <text>
                    <![CDATA[
                    <script type="text/javascript" src="http://use.typekit.com/ysw8aaa.js"></script>
                    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
                    ]]>
                </text>
             </action>
        </block>
    </reference>
</layout>

Ensure you replace http://use.typekit.com/ysw8aaa.js with your actual Typekit JavaScript URL.

Step 4: Flush Magento Cache

After saving the file, don’t forget to flush your Magento cache. You can do this via command line:

php shell/index.php --shell-cache-clear

Or from the admin panel:

  • Navigate to System > Tools > Cache Management
  • Select all options and click Flush Cache Storage

Conclusion

That’s it! By following these steps, you’ve successfully applied your Typekit font site-wide in your Magento store. This approach ensures consistency across pages without the need for manual insertion.

Remember, customizing your theme’s layout XML files is a core part of Magento development. You can explore more advanced customizations like partial layouts and local layouts on our blog at Laravel Company.

Happy coding! Let me know if you have any questions or need further clarification on this process.

Disclaimer: While I strive for accuracy, always double-check your code before deployment to ensure it aligns with your specific environment and requirements.

Magento 1 Security Themes Admin

Our network