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

Default ASSET_PATH fails for latest jekyll version #290

Closed brbrr closed 8 years ago

brbrr commented 8 years ago

serving default jekyll-bootstrap blog with latest (3.0.0) jekyll will not load assets for blogs i.e. core-samples/lessons/2011/12/29/jekyll-introduction Looks like with new verison Jekyll/Liquid front matter do not inherit theme variable from layouts, thats why page.theme.name is empty.

as workaround its possible to define theme for every post, or define ASSET_PATH directly in config.

btw - why not to define theme variable in config file to use in JB/setup ?

UPD: as for jekyll 3.0 layout variables now accessible with layout.variable. So updating JB/setup's capture of ASSET_PATH would resolve issue but only for posts.

I'm not sure why, but it still wont work for any layout: page pages.

Here is my workaroud

# JB/setup
{% capture ASSET_PATH %}{{ BASE_PATH }}/assets/themes/{{ site.JB.THEME }}{% endcapture %}

# _config.yml
JB :
  THEME : bootstrap-3
aaronxn commented 8 years ago

Had the same problem. The solution for the Bootstrap Theme included the above hack and:

  1. Rename /assets/themes/bootstrap-3 to bootstrap
  2. Rename /assets/themes/bootstrap/css to css-backup
  3. Move /assets/themes/bootstrap/bootstrap folders (css, fonts, js) to /assets/themes/bootstrap

Not very pretty, but it works for my site.

wesleywerner commented 8 years ago

@tops357 if you replace your #2 with:

mv /assets/themes/bootstrap/css /assets/themes/

then if will also fix the style.css file. But I see switching to another theme breaks this hack too.

What works for me is:

  1. rake theme:switch name="bootstrap-3/twitter"
  2. define ASSET_PATH directly in config as pointed out by @brbrr - ASSET_PATH : /assets/themes/{bootstrap-3/twitter}

Unfortunate it is a double-barrel step but it works.

bdeanindy commented 8 years ago

A quick cheat for this (if you just need to get things working and you want to use a theme, for instance I was using the hooligan theme which I really like).

I just opened the /_config.yml and changed ASSET_PATH to be /assets/themes/hooligan.

That seemed to do the trick (for now until I can figure out what the heck is causing the theme.name value to get lost).

I know this is a total hack, but I was looking for a "single location" to make the changes I needed and that seemed to do the trick (so I could leave all the other structure alone).

Hope it helps someone.

wizardxbl commented 8 years ago

I have the same problem. when i run jekyll serve i can see the index.html for first page, it has right theme but the other pages has no theme.

the right link is like is:

but the wrong link is:

i try the layout.theme.name but not work for me.....

UPD: Sorry, the layout.theme.name is worked! for index.html , page.theme.name is work and for other pages, layout.theme.name is work so the patch #293 is well done. if -- else for two situation.

thanks a lot.

seoyoochan commented 8 years ago

this is still not working... i had to manually set ASSET_PATH with the theme name

lefttree commented 8 years ago

Have the same problem when I run jekyll serve on Mac. It's always trying to find assets at /assets/themes/ directory instead of /assets/themes/<theme name>.

Hack as above to manually change the ASSET_PATH, hope for a better solution.

yanhaijing commented 8 years ago

i have same question,let me try #293,it work,good job!!!

einverne commented 8 years ago

@qh 's patch is working. See https://github.com/qh/jekyll-bootstrap/commit/a1d17efdb782a6ce343458d9e8af1d510efb71d9 or https://github.com/plusjade/jekyll-bootstrap/pull/293

brbrr commented 8 years ago

Closing, as #293 was merged in to develop branch.

dsposito commented 8 years ago

Thanks for documenting a fix here. :+1: Setting ASSET_PATH in my config did the trick.

1kohei1 commented 8 years ago

Thanks for this issue! It was trouble some last several months!