我刚刚使用http://fontello.com/生成了一个个性化的字体-awesome
当我尝试在我的 Ghost 安装中引用它时,文件总是返回 404。这就是我所做的:
我在文件夹 /content/themes/[theme name]/assets/fonts 上添加了生成的字体文件的完整文件夹
我从 default.hbs 引用主 .css 文件
像这样:
<link rel="stylesheet" type="text/css" href="{{asset "fonts/custom_webfont.css"}}">
这个 .css 文件有一个指令,允许不同的浏览器为所服务的字体选择支持的文件类型:
@font-face {
font-family: 'custom_webfont';
src: url('custom_webfont.eot');
src: url('custom_webfont.eot#iefix') format('embedded-opentype'),
url('custom_webfont.woff') format('woff'),
url('custom_webfont.ttf') format('truetype'),
url('custom_webfont.svg#custom_webfont') format('svg');
font-weight: normal;
font-style: normal;
}
当我的 ghost 安装上的任何页面被渲染时,它会正确地为这个地址上的 CSS 提供服务:
/assets/fonts/custom_webfont.css?v=594627dbc0
(我假设额外的 v 号用于缓存目的)
但不提供字体文件。如果我尝试这些 URL 中的任何一个,都找不到:
http://localhost:2368/assets/fonts/custom_webfont.woff/?v=594627dbc0
http://localhost:2368/assets/fonts/custom_webfont.woff
http://localhost:2368/assets/fonts/custom_webfont.eof/?v=594627dbc0
http://localhost:2368/assets/fonts/custom_webfont.eof