What's your biggest current challenge? Have your say in Community Polls along the right column.

Uploading Custom Fonts

Uploading Custom Fonts

tierramb
Visitor
1 0 1

I really need help uploading two custom free fonts to my website (Trend Sans Five & Telegraf Regular). I have done all of the following:

 

1 - Uploaded the font as a .woff file in the assets section.

2 -  Pasted the following code at the top of the styles section of the </>theme.liquid part of the website: 

 

@font-face {font-family: 'TrendSans Five';
src: url('{{ '[TrendSans Five.woff](http://Five.woff)' | asset_url }}') format('woff');
}
@font-face {
font-family: 'TelegrafRegular';
src: url('{{ '[TelegrafRegular.woff](http://Telegraf.woff)' | asset_url }}') format('woff')

 

3- Previously tried it at the bottom of the base.css section

4-Cleared Browser, Cache, Cookies History 

5- I'm seeing the following error message when I hover over the link: 'assets/[TelegrafRegular.woff](http://TelegrafRegular.woff)' does not exist &

'assets/[TrendSans Five.woff](http://TrendSans Five.woff)' does not exist 

 

Could someone please assist me with this? 

Replies 3 (3)

Guleria
Shopify Partner
3692 741 1039

Hello @tierramb ,

 

Try to upload the font under Content ->  Files
Copy the path and update in the css you have 
@font-face {font-family: 'TrendSans Five';
src: url('https://cdn.shopify.com/s/files -your-path') format('woff');
}

- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder

tim
Shopify Partner
3911 394 1435

You can't use Liquid code in .css files.

You can't nest quotation marks or ticks like you do in your code sample (though it's formatted in a way which is hard to understand)

Also, recently I've encountered that uploading font files to Assets damages them, not sure if it's already solved.

Uploading to Files worked. Also, you should be able to avoid theme modifications in this case if you paste your code into Custom liquid section...

 

You can try using  section by @diego_ezfy (https://ezfycode.com/blog/add-custom-fonts-to-shopify) for this.

 

if you're doing this inside .liquid file or Custom liquid sections, the code should be like this (if you upload to Files!):
(note how I am using both quotes and ticks to avoid nesting)

<style>
  @font-face {
    font-family: "TrendSans Five";
    src: url("{{ 'TrendSans Five.woff' | file_url }}") format("woff");
  }
  @font-face {
    font-family: "TelegrafRegular";
    src: url("{{ 'TelegrafRegular.woff' | file_url }}") format("woff");
  }
</style>
 

 Also, if you're uploading to Files, you can copy URL for these files and replace {{ 'TrendSans Five.woff' | file_url }} with the actual URL. In this case you can paste rules into Custom CSS (as liquid is not processed there).

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

PageFly-Richard
Shopify Partner
4808 1088 1757

This is Richard from PageFly - Shopify Page Builder App

 

Hi @tierramb  you need add code inside tag <style> if you want use this code in theme.liquid:

Step 1: Online Stores > Themes > Edit code

Step 2: Choose file theme.liquid
Step 3: Add code above the tag </body>

 

<style>
@font-face {font-family: 'TrendSans Five';
src: url('{{ '[TrendSans Five.woff](http://Five.woff)' | asset_url }}') format('woff');
}
@font-face {
font-family: 'TelegrafRegular';
src: url('{{ '[TelegrafRegular.woff](http://Telegraf.woff)' | asset_url }}') format('woff')
</style>

 

Hope my solution will help you resolve the issue.

 

Best regards,

Richard | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 


All features are available from Free plan. Live Chat Support is available 24/7.