Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve "styles.main.css" #15

Open
TheHackerDev opened this issue Sep 14, 2017 · 2 comments
Open

Unable to resolve "styles.main.css" #15

TheHackerDev opened this issue Sep 14, 2017 · 2 comments

Comments

@TheHackerDev
Copy link

TheHackerDev commented Sep 14, 2017

When using the baseURL of "/" (as recommended in a number of places, including here), the main.css file is attempting to be loaded from http:https://styles/main.css, which obviously doesn't resolve anywhere.

Here's the relevant line of code: https://github.com/tomanistor/osprey/blob/master/layouts/partials/header.html#L74

I fixed this by changing it to the following:

<link rel="stylesheet" href="{{ .Site.BaseURL }}styles/{{ if .Site.Params.cacheBustCSS }}{{ index .Site.Data.styles.hash "main.css" }}{{ else }}main.css{{ end }}" type="text/css">

I simply removed the leading / before styles/, so it would load from [baseUrl]/styles/main.css.

Cheers,
Aaron (insp3ctre)

@TheHackerDev
Copy link
Author

Just FYI the same issue happened on the blog.html page. I changed the same element of the line as follows:

<div class="col-xs-12"><h3><a href="{{ .Site.BaseURL }}blog/">View All</a></h3></div>

Cheers,
Aaron (insp3ctre)

@crgeary
Copy link

crgeary commented Oct 13, 2017

This can also be solved with:

{{ if .Site.Params.cacheBustCSS }}
    <link rel="stylesheet" href="{{ (index .Site.Data.cachedAssets "main.css") | absURL }}">
{{ else }}
    <link rel="stylesheet" href="{{ "/styles/main.css" | absURL }}">
{{ end }}

Similar issue with the og:image which could be:

<meta property="og:image" content="{{ .Site.Params.opengraphImage | absURL }}">

And with the favicon, which could be:

<link rel="icon" type="image/png" sizes="16x16" href="{{ "/images/logo/favicon.ico" | absURL }}">

However setting the baseURL to / actually uncovers additional problems. For example, og:url is equal to .Site.BaseURL which it seems should be a full url with domain/protocol, but in this case would be just a /.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants