Check if current page is homepage on Jekyll
You can use page.url to check if the current page is your index page: {% if page.url == “/index.html” %} <h1>…</h1> {% endif %}
You can use page.url to check if the current page is your index page: {% if page.url == “/index.html” %} <h1>…</h1> {% endif %}
You can also start the server with an additional argument –port 1234 or –host hostname. For example: $ jekyll serve –port 4001 –host my_hostname_or_ip You can view all the possible CLI flags from The official Jekyll documentation
Since Jekyll 2.0, you can use Front Matter Defaults: defaults: – scope: path: “” # empty string for all files type: posts # limit to posts values: is_post: true # automatically set is_post=true for all posts then you can use {{ page.is_post }} to check whether the page is post. No idea why Jekyll doesn’t … Read more
I added gem “kramdown-parser-gfm” to the Gemfile and then ran bundle install. Now the serve command completes successfully.
Adding only markdown: redcarpet into _config.yml is not enough, It’s also need the extensions part, e.g. markdown: redcarpet redcarpet: extensions: [“no_intra_emphasis”, “fenced_code_blocks”, “autolink”, “tables”, “with_toc_data”]
You can use this plugin. Copy and paste this code in a file inside the _plugins directory at the root of your Jekyll project. https://gist.github.com/jgatjens/8925165 Then to use it just add the lines below {% loop_directory directory:images iterator:image filter:*.jpg sort:descending %} <img src=”https://stackoverflow.com/questions/17446472/{{ image }}” /> {% endloop_directory %}
I had the same issue but fixed it installing pygments gem. gem install pygments.rb And adding it to my Gemfile. gem ‘pygments.rb’
This also works at least as of 1.0.0, is built in and is simple to use. <ul> {% for post in site.posts %} <li> <a href=”https://stackoverflow.com/questions/10859175/{{ post.url }}”>{{ post.title }}</a> <p>{{ post.excerpt }}</p> </li> {% endfor %} </ul> See here.
Frontmatter This is a good workaround, add to the top of your file: — my_array: – one – two – three — then use it as: {{ page.my_array }} Analogous for site wide site.data.my_array on the _config or under _data/some_file.yml. Jekyll 3 update for layouts If the frontmatter is that of a layout, you need … Read more
There is an example in the official Jekyll documentation how to create a basic post archive page: Displaying an index of posts Bonus: For a prettier archive page (grouped by year or year/month), see this answer. You’re right, I can’t find anything in the docs where it says how the posts are ordered, but in … Read more