From 660c14498e758f3ec2c6b8ecb713185fa1ace8bb Mon Sep 17 00:00:00 2001 From: DigitalAdapt Date: Sun, 20 Jan 2019 22:31:16 -0500 Subject: [PATCH] Converting nav to supporting category pages. --- _includes/nav.html | 2 ++ _includes/posts.html | 35 +++++++++++++++++++++++++++++++++++ _layouts/category.html | 7 +++++++ 3 files changed, 44 insertions(+) create mode 100644 _includes/posts.html create mode 100644 _layouts/category.html diff --git a/_includes/nav.html b/_includes/nav.html index d29e879..991a2c2 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -4,6 +4,8 @@ {%- if my_page.title -%} {%- if my_page.url == page.url -%}
  • {{ my_page.title }}
  • + {%- elsif page.url contains my_page.url and my_page.url != "/" -%} +
  • {{ my_page.title }}
  • {%- else -%}
  • {{ my_page.title }}
  • {%- endif -%} diff --git a/_includes/posts.html b/_includes/posts.html new file mode 100644 index 0000000..c2964b8 --- /dev/null +++ b/_includes/posts.html @@ -0,0 +1,35 @@ +{%- for category in site.categories -%} + {%- if category[0] != page.category -%} + {%- continue -%} + {%- endif -%} + + {%- assign posts = category[1] -%} + + {%- if posts.size > 0 -%} +
    +
    + {%- if page.list_title -%} +

    {{ page.list_title | capitalize }}

    + {%- endif -%} +
    + {%- assign date_format = site.date_format | default: "%b %-d, %Y" -%} + {%- for post in posts -%} + + {%- endfor -%} +
    +
    +
    + {%- endif -%} + {%- break -%} +{%- endfor -%} diff --git a/_layouts/category.html b/_layouts/category.html new file mode 100644 index 0000000..bb2aed9 --- /dev/null +++ b/_layouts/category.html @@ -0,0 +1,7 @@ +--- +layout: default +--- + +{{ content }} + +{% include posts.html %}