jekyll-haml icon indicating copy to clipboard operation
jekyll-haml copied to clipboard

I'm not sure it's an issue but more of a question...

Open franceindia opened this issue 10 years ago • 4 comments

Hi I'm new to Jekyll and liquid tags (but not HAML). With this plugin, I can pull in a basic haml partial using

{% haml footer.hml %}

My problem: The default Jekyll index page fails to compile when I try to convert index.html to index.haml. How should it be written? This is what I have...


%div#home
    %h1 Blog Posts
    .posts
        {% for post in site.posts %}
            %li
                %span {{ post.date | date_to_string }}
                »
                %a{:href => "{{ post.url }}"}
                    {{ post.title }}
        {% endfor %}

What am I missing? Thanks!

franceindia avatar Sep 16 '13 13:09 franceindia

:+1:

Can we just use .haml pages that will be converted to .html?

Uko avatar Oct 03 '13 08:10 Uko

Anyone found a workaround for this issue? I really need keep the comon parts of my layouts in shared files.

Stratus3D avatar Dec 27 '13 22:12 Stratus3D

In Haml, indentation has a special meaning (it represents the hierarchy).

Haml conversion happens before Liquid conversion, and all your Liquid commands are plain text for Haml.

Therefore, whenever using things like {% for %} or {% if %}, you are not allowed to indent the code block it is enclosing (There should never be 2 indentation levels between two Haml tags like .foo or %bar)

This should work:

%div#home
  %h1 Blog Posts
  .posts
  {% for post in site.posts %}
    %li
      %span {{ post.date | date_to_string }}
      »
      %a{:href => "{{ post.url }}"}
        {{ post.title }}
  {% endfor %}

felixkiss avatar Aug 07 '14 07:08 felixkiss

@felixkiss, thank you for that example, it helped me to make it work! :raised_hands:

gnclmorais avatar Mar 14 '16 08:03 gnclmorais