Why should I put {% include JB/setup %} in each post in Jekyll bootstrap?

718 Views Asked by At

I am using Jekyll Bootstrap. And I can post an article, however I don't know why post template put {% include JB/setup %} in each post markdown file. I have little knowledge about ruby and Jekyll. But I check some document and I can understand some codes. But I still don't know what this means:

{% capture jbcache %}
  <!--
  - Dynamically set liquid variables for working with URLs/paths
  -->
  {% if site.JB.setup.provider == "custom" %}
    {% include custom/setup %}
  {% else %}
    {% if site.safe and site.JB.BASE_PATH and site.JB.BASE_PATH != '' %}
      {% assign BASE_PATH = site.JB.BASE_PATH %}
      {% assign HOME_PATH = site.JB.BASE_PATH %}
    {% else %}
      {% assign BASE_PATH = nil %}
      {% assign HOME_PATH = "/" %}
    {% endif %}

    {% if site.JB.ASSET_PATH %}
      {% assign ASSET_PATH = site.JB.ASSET_PATH %}
    {% else %}
      {% capture ASSET_PATH %}{{ BASE_PATH }}/assets/themes/{{ page.theme.name }}{% endcapture %}
    {% endif %}  
  {% endif %}
{% endcapture %}{% assign jbcache = nil %}

I have checked this question. I am still confused. So this is my question:

  1. Why should I put {% include JB/setup %} in each post in Jekyll bootstrap?
  2. Can I modify template to remove {% include JB/setup %} in each post?
3

There are 3 best solutions below

7
On BEST ANSWER

This is because you are using command rake post title="new post name".

See Rakefile here:

puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
  post.puts "---"
  post.puts "layout: post"
  post.puts "title: \"#{title.gsub(/-/,' ')}\""
  post.puts 'description: ""'
  post.puts "category: #{category}"
  post.puts "tags: #{tags}"
  post.puts "---"
  post.puts "{% include JB/setup %}"
end

Removing line post.puts "{% include JB/setup %}" will do the trick.

0
On

That's because JB/setup file setup variables like BASE_PATH, ASSET_PATH; Suppose a scenario:In your template file or html file, you have the following code then you will occur errors. That's because you get an incorrect value for ASSET_PATH; If you are using Jekyll Bootstraps like I do,you will find some comments in file "root_directory"/_config.yml for your better understanding:

# By default, the asset_path is automatically defined relative to BASE_PATH plus the enabled theme.
# ex: [BASE_PATH]/assets/themes/[THEME-NAME]
#
# Override this by defining an absolute path to assets here.
# ex:
#   http://s3.amazonaws.com/yoursite/themes/watermelon
#   /assets
#
ASSET_PATH : false  
0
On

not exactly.

While this seems true, it never sets, even at the base layout, using asset-path or similar tags never works for me. Id advise removing it. And adding in '/' as it says, and I have bugged, is incorrect. './' is more correct but jekyll doesnt seem to see the dots. (you are pointing to the root of a linux drive, where the files simply are not)

thank you for the clarification. the existance of it is moot, it was added in during theme 'installation' which is really a waste.

you only need the layouts folder and "theme_packs" if you want more than one theme available. otherwise, just the layouts folder. The includes are for JB, which, as noted here is moot to exist in the first place.

The only instance you need bootstrap(and this is NOT correct in implementation in jekyll) is for lets say a menu.

bootstrap css file javascript file

no connection what-so-ever to jekyll.You have to implement this yourself.