From b7d83bc185cf7379339c845488035d24bbebaf10 Mon Sep 17 00:00:00 2001 From: Will Cohen Date: Wed, 19 Jun 2024 15:18:30 -0400 Subject: [PATCH 1/3] [example] copy liquid examples from njk --- .../examples/pagination/nav/combined.liquid | 14 ++++++++++++++ .../examples/pagination/nav/firstlast.liquid | 12 ++++++++++++ .../examples/pagination/nav/nextprev.liquid | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/_includes/examples/pagination/nav/combined.liquid create mode 100644 src/_includes/examples/pagination/nav/firstlast.liquid create mode 100644 src/_includes/examples/pagination/nav/nextprev.liquid diff --git a/src/_includes/examples/pagination/nav/combined.liquid b/src/_includes/examples/pagination/nav/combined.liquid new file mode 100644 index 0000000000..dd36f8a00f --- /dev/null +++ b/src/_includes/examples/pagination/nav/combined.liquid @@ -0,0 +1,14 @@ +{% raw %} + +{% endraw %} \ No newline at end of file diff --git a/src/_includes/examples/pagination/nav/firstlast.liquid b/src/_includes/examples/pagination/nav/firstlast.liquid new file mode 100644 index 0000000000..fee5abc25d --- /dev/null +++ b/src/_includes/examples/pagination/nav/firstlast.liquid @@ -0,0 +1,12 @@ +{% raw %} + +{% endraw %} diff --git a/src/_includes/examples/pagination/nav/nextprev.liquid b/src/_includes/examples/pagination/nav/nextprev.liquid new file mode 100644 index 0000000000..8cd9ac5cd7 --- /dev/null +++ b/src/_includes/examples/pagination/nav/nextprev.liquid @@ -0,0 +1,13 @@ + +{% raw %} + +{% endraw %} \ No newline at end of file From 2c69d59c5ae0deaa0b03876d3b636d99e11cc8ac Mon Sep 17 00:00:00 2001 From: Will Cohen Date: Wed, 19 Jun 2024 15:22:26 -0400 Subject: [PATCH 2/3] [examples] convert njk examples to liquid The only differences here is that liquid uses the variable name `forloop` instead of `loop` --- src/_includes/examples/pagination/nav/combined.liquid | 2 +- src/_includes/examples/pagination/nav/firstlast.liquid | 2 +- src/_includes/examples/pagination/nav/nextprev.liquid | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_includes/examples/pagination/nav/combined.liquid b/src/_includes/examples/pagination/nav/combined.liquid index dd36f8a00f..f279602f2b 100644 --- a/src/_includes/examples/pagination/nav/combined.liquid +++ b/src/_includes/examples/pagination/nav/combined.liquid @@ -5,7 +5,7 @@
  • {% if page.url != pagination.href.first %}First{% else %}First{% endif %}
  • {% if pagination.href.previous %}Previous{% else %}Previous{% endif %}
  • {%- for pageEntry in pagination.pages %} -
  • Page {{ loop.index }}
  • +
  • Page {{ forloop.index }}
  • {%- endfor %}
  • {% if pagination.href.next %}Next{% else %}Next{% endif %}
  • {% if page.url != pagination.href.last %}Last{% else %}Last{% endif %}
  • diff --git a/src/_includes/examples/pagination/nav/firstlast.liquid b/src/_includes/examples/pagination/nav/firstlast.liquid index fee5abc25d..d3750497bf 100644 --- a/src/_includes/examples/pagination/nav/firstlast.liquid +++ b/src/_includes/examples/pagination/nav/firstlast.liquid @@ -4,7 +4,7 @@
    1. {% if page.url != pagination.href.first %}First{% else %}First{% endif %}
    2. {%- for pageEntry in pagination.pages %} -
    3. Page {{ loop.index }}
    4. +
    5. Page {{ forloop.index }}
    6. {%- endfor %}
    7. {% if page.url != pagination.href.last %}Last{% else %}Last{% endif %}
    diff --git a/src/_includes/examples/pagination/nav/nextprev.liquid b/src/_includes/examples/pagination/nav/nextprev.liquid index 8cd9ac5cd7..350164ce6f 100644 --- a/src/_includes/examples/pagination/nav/nextprev.liquid +++ b/src/_includes/examples/pagination/nav/nextprev.liquid @@ -5,7 +5,7 @@
    1. {% if page.url != pagination.href.first %}First{% else %}First{% endif %}
    2. {%- for pageEntry in pagination.pages %} -
    3. Page {{ loop.index }}
    4. +
    5. Page {{ forloop.index }}
    6. {%- endfor %}
    7. {% if page.url != pagination.href.last %}Last{% else %}Last{% endif %}
    From e5d5fb5c3950188a827b783aa7018bca41daeedc Mon Sep 17 00:00:00 2001 From: Will Cohen Date: Wed, 19 Jun 2024 15:24:24 -0400 Subject: [PATCH 3/3] [doc] update pagination nav docs with new examples --- src/docs/pagination/nav.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/docs/pagination/nav.md b/src/docs/pagination/nav.md index 5b1adaa527..fea41b6145 100644 --- a/src/docs/pagination/nav.md +++ b/src/docs/pagination/nav.md @@ -257,7 +257,10 @@ Note that if the current page (`page.url`) is the first or last in the set, we w {% renderFile "./src/_includes/syntax-chooser-tablist.11ty.js", {id: "paged-nav-nextprev", valid: "njk,js"} %}
    -

    This example has not yet been added—you can swap to another template language above! Or maybe you want to contribute it? {% include "edit-on-github.njk" %}

    + {%- codetitle "nextprev.liquid" %} + {%- highlight "liquid" %} + {%- include "examples/pagination/nav/nextprev.liquid" %} + {%- endhighlight %}
    {%- codetitle "nextprev.njk" %} @@ -284,7 +287,10 @@ For clarity here, we’re omitting the previous and next links from the previous {% renderFile "./src/_includes/syntax-chooser-tablist.11ty.js", {id: "paged-nav-firstlast", valid: "njk,js"} %}
    -

    This example has not yet been added—you can swap to another template language above! Or maybe you want to contribute it? {% include "edit-on-github.njk" %}

    + {%- codetitle "firstlast.liquid" %} + {%- highlight "liquid" %} + {%- include "examples/pagination/nav/firstlast.liquid" %} + {%- endhighlight %}
    {%- codetitle "firstlast.njk" %} @@ -309,7 +315,10 @@ Here’s the final pagination navigation template code, pieced together: {% renderFile "./src/_includes/syntax-chooser-tablist.11ty.js", {id: "paged-nav-combined", valid: "njk,js"} %}
    -

    This example has not yet been added—you can swap to another template language above! Or maybe you want to contribute it? {% include "edit-on-github.njk" %}

    + {%- codetitle "combined.liquid" %} + {%- highlight "liquid" %} + {%- include "examples/pagination/nav/combined.liquid" %} + {%- endhighlight %}
    {%- codetitle "combined.njk" %}