spike
September 13, 2018, 8:53pm
1
Hi, having issues with loading/referencing any asset files that are contained in a regular sub dir on my server. Whenever I try to call it directly ghost gives me a 404 for css/js/images.
graphitika.net
latest
nginx latest
FF latest
n/a
any asset files (js, images, css) called receive 404, seems ghost is appending a / at the tail end of any assets
e.g. example.com/style.css is transformed to example.com/style.css/
I’ve tried the {{asset }} tags but same thing keeps popping up.
need to be able to call css/js and imagery
John
September 13, 2018, 9:00pm
2
You’ll need to use the {{asset}}
helper, and then clear all relevant caches (try using incognito mode on browser, too) to ensure that the changes are taking effect
See default theme code for an example:
<!DOCTYPE html>
<html lang="{{@site.locale}}"{{#match @custom.color_scheme "Dark"}} class="dark-mode"{{else match @custom.color_scheme "Auto"}} class="auto-color"{{/match}}>
<head>
{{!-- Basic meta - advanced meta is output with {ghost_head} below --}}
<title>{{meta_title}}</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{!-- Theme assets - use the {asset} helper to reference styles & scripts,
this will take care of caching and cache-busting automatically --}}
<link rel="stylesheet" type="text/css" href="{{asset "built/screen.css"}}" />
{{!-- This tag outputs all your advanced SEO meta, structured data, and other important settings,
it should always be the last tag before the closing head tag --}}
{{ghost_head}}
</head>
This file has been truncated. show original
spike
September 14, 2018, 3:27am
3
Hmmm had no apparent effect, since I used your suggested method and called the style sheet in question it didn’t render the desired font to a particular css class.
In theme root you have to have a folder named “assets”. {{asset}}
helper points to that directory.
So in your theme, if the file location is assets/css/style.css
then use the following line to reference that file.
<link rel="stylesheet" type="text/css" href="{{asset "css/style.css"}}" />
1 Like
system
Closed
September 28, 2018, 7:17am
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.