Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Problems with {{ ASSET_PATH }} in Jekyll 3.1.1 #295

Closed
ploeh opened this issue Feb 2, 2016 · 15 comments · Fixed by #311
Closed

Problems with {{ ASSET_PATH }} in Jekyll 3.1.1 #295

ploeh opened this issue Feb 2, 2016 · 15 comments · Fixed by #311

Comments

@ploeh
Copy link

ploeh commented Feb 2, 2016

Please accept my apologies in advance if this issue is inappropriate, or if it's a duplicate.

Since GitHub Pages updated to run on Jekyll 3.0 February 1, 2016, {{ ASSET_PATH }} no longer includes the theme on my site.

As an example, this:

<link href="{{ ASSET_PATH }}/bootstrap/css/bootstrap.min.css" rel="stylesheet">

generates this:

<link href="/assets/themes//bootstrap/css/bootstrap.min.css" rel="stylesheet">

(notice the double slashes between themes and bootstrap) while I would have expected it to generate this:

<link href="/assets/themes/ploeh/bootstrap/css/bootstrap.min.css" rel="stylesheet">

which Jekyll 2 did.

I'm neither a Jekyll expert nor a Ruby programmer, but AFAICT, ASSET_PATH is built in JB/Setup. Here, it uses {{ page.theme.name }}, but as far as I can tell, this expression evaluates to nothing (or the empty string).

My _layout files essentially look like the following, so I can't figure out what I'm doing wrong:

default.hml


---
theme :
  name : ploeh

---
{% include JB/setup %}
{% include themes/ploeh/default.html %}

page.html

theme :
  name : ploeh
layout: default

---
{% include JB/setup %}
{% include themes/ploeh/page.html %}

post.html

theme :
  name : ploeh
layout: default

---
{% include JB/setup %}
{% include themes/ploeh/post.html %}

My entire site's source code is publicly available, if that's any help.

What am I doing wrong, and what can I do to correct the problem?

@ploeh
Copy link
Author

ploeh commented Feb 2, 2016

I may have found the problem. In JB/Setup the script uses {{ page.theme.name }}, but it seems that in Jekyll 3, it has to be {{ layout.theme.name }}.

Making this change seems to solve my problem.

Is this expected?

@parkr
Copy link
Contributor

parkr commented Feb 2, 2016

@einverne
Copy link

einverne commented Feb 3, 2016

It seems the same issue as #290 .

@ploeh
Copy link
Author

ploeh commented Feb 3, 2016

Perhaps. It fixes issues with posts, but not with other pages.

Right now I'm resorting to the hack setting ASSET_PATH in _config.yml.

@groundh0g
Copy link
Collaborator

@ploeh I'm guessing the issue with the other pages might be that they're no longer generated with extensions. So "/archive.html" is now "/archive/", "/tags.html" is now "/tags/", etc ....

I had to make that tweak on my default.html header navigation links under _includes/themes/mytheme/.

I'll make sure there's not already one, then issue a PR later this week.

@groundh0g
Copy link
Collaborator

Add to the list the following edit in _config.yml ...

-  archive_path: /archive.html
-  categories_path : /categories.html
-  tags_path : /tags.html
+  archive_path: /archive/
+  categories_path : /categories/
+  tags_path : /tags/

ploeh added a commit to ploeh/ploeh.github.com that referenced this issue Feb 10, 2016
like it was before. According to the discussion at
plusjade/jekyll-bootstrap#295 (comment)
the changes I've previously made to archive_path, etc. might be enough. I
can't say that I understand this, but we'll see.

It looks OK on my machine, but it also did that before, and still looked
horrible in GitHub pages.
@ploeh
Copy link
Author

ploeh commented Feb 10, 2016

No, that doesn't help.

Or rather, it looks fine on my machine, but when hosted by GitHub Pages, all styling is gone.

@groundh0g
Copy link
Collaborator

Hmmm. Could be the permalink?

-permalink: /:categories/:year/:month/:day/:title 
+permalink: /:categories/:year/:month/:day/:title/

(Note the trailing /.)

Guessing based on: 1) I made that edit in my _config.yml earlier, and 2) the jekyll 3.x upgrade docs mention it.

If you don't mind, give that a go and let me know.

@groundh0g
Copy link
Collaborator

Never mind. The symptom for that would be a 404 error. Still probably needs to be tweaked, though.

@ploeh
Copy link
Author

ploeh commented Feb 10, 2016

Thank you, but it's not that either...

@ghost
Copy link

ghost commented Feb 17, 2016

Ok... so jekyll upgrade broke my website too (http://www.ajaygautam.com)
Filed details at https://talk.jekyllrb.com/t/3-x-upgrade-issues/1965 and someone redirected me here.

changing {{ page.theme.name }} to {{ layout.theme.name }} fixes everything except my home page!
Any idea what may be wrong?

Thanks

Ajay

@ghost
Copy link

ghost commented Feb 17, 2016

just saw ploeh's post above. Updated ASSET_PATH in _config.yml - that fixed the issue, but its a very icky solution/workaround.

If anyone knows of a better solution, please post here.

Thanks

kylemanna added a commit to kylemanna/kylemanna.github.com that referenced this issue Feb 21, 2016
tyranja pushed a commit to tyranja/heartofcode that referenced this issue Feb 22, 2016
benpoole added a commit to LDCVia/ldcvia-blog-public that referenced this issue Feb 24, 2016
lcolladotor added a commit to lcolladotor/lcolladotor.github.com that referenced this issue Feb 25, 2016
@lcolladotor
Copy link

Using both #295 (comment) and changing the ASSET_PATH fixed my website. Thanks!

@hbrysiewicz
Copy link

I also have this problem and have updated to Jekyll 3 but am wondering how to update jekyll-bootstrap? I have a blog running on 0.2.13 but would like to update it and can't find anything in the docs.

@ploeh
Copy link
Author

ploeh commented Apr 7, 2016

I also have this problem and have updated to Jekyll 3 but am wondering how to update jekyll-bootstrap?

I simply* pulled down the changes from the the Jekyll Bootstrap remote and merged them. I don't know how your blog is set up, but mine is configured like this:

$ git remote --verbose
jekyll-bootstrap        https://github.com/plusjade/jekyll-bootstrap.git (fetch)
jekyll-bootstrap        https://github.com/plusjade/jekyll-bootstrap.git (push)
origin  https://github.com/ploeh/ploeh.github.com.git (fetch)
origin  https://github.com/ploeh/ploeh.github.com.git (push)

*Actually, it wasn't that simple, because I had to deal with a handful of merge conflicts, but I managed...

pogin503 added a commit to emacs-jp/emacs-jp.github.com that referenced this issue Jun 3, 2016
CSSが読み込まれない理由としては、 {{ page.theme.name }} が空になってしまうようで、linkタグが
<link href="/assets/themes//bootstrap/css/bootstrap.min.css" rel="stylesheet">
このように生成されてしまいます。

以下を参考にして、_include/JB/setup の {{ page.theme.name }} を
{{ layout.theme.name }} に変えたらCSSを読み込みました。

[Default ASSET_PATH fails for latest jekyll version #290](plusjade/jekyll-bootstrap#290)
[Problems with {{ ASSET_PATH }} in Jekyll 3.1.1 #295](plusjade/jekyll-bootstrap#295)

Error Message:
[2016-06-04 01:47:15] ERROR `/assets/themes/bootstrap/css/bootstrap.min.css' not found.
[2016-06-04 01:47:15] ERROR `/assets/themes/css/style.css' not found.
eschwartz added a commit to eschwartz/eschwartz.github.io that referenced this issue Sep 18, 2017
Github Pages upgraded to Jekyll 3 -
which includes major breaking changes -
and did not tell anyone about it....

See:
- plusjade/jekyll-bootstrap#295
- http://jekyllrb.com/docs/upgrading/2-to-3/#layout-metadata
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants