plusjade / jekyll-bootstrap

The quickest way to start and publish your Jekyll powered blog. 100% compatible with GitHub pages.
jekyllbootstrap.com
MIT License
3.35k stars 1.71k forks source link

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

Closed ploeh closed 8 years ago

ploeh commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

@ploeh In Jekyll, yes. See: http://jekyllrb.com/docs/upgrading/2-to-3/#layout-metadata

einverne commented 8 years ago

It seems the same issue as https://github.com/plusjade/jekyll-bootstrap/issues/290 .

ploeh commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

No, that doesn't help.

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

groundh0g commented 8 years ago

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 commented 8 years ago

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

ploeh commented 8 years ago

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

ghost commented 8 years ago

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 commented 8 years ago

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

lcolladotor commented 8 years ago

Using both https://github.com/plusjade/jekyll-bootstrap/issues/295#issuecomment-178869307 and changing the ASSET_PATH fixed my website. Thanks!

hbrysiewicz commented 8 years ago

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 commented 8 years ago

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...