diff options
-rw-r--r-- | _includes/posts_by_author.html | 7 | ||||
-rw-r--r-- | _includes/slnum.html | 11 | ||||
-rw-r--r-- | _layouts/author.html | 11 | ||||
-rw-r--r-- | _layouts/default.html | 2 | ||||
-rw-r--r-- | _layouts/post.html | 16 | ||||
-rw-r--r-- | _posts/2020-11-05-prva-objava.md | 1 | ||||
-rw-r--r-- | _posts/2020-11-06-druga-objava.md | 8 | ||||
-rw-r--r-- | kategorije.html | 33 |
8 files changed, 74 insertions, 15 deletions
diff --git a/_includes/posts_by_author.html b/_includes/posts_by_author.html new file mode 100644 index 0000000..c0fbb4c --- /dev/null +++ b/_includes/posts_by_author.html @@ -0,0 +1,7 @@ +{% comment %} argv: authorname {% endcomment %} +{% assign posts_by_author = site.posts | where: "author", argv[0] %} +{% assign author_not_specified = site.posts | where: 'author', nil %} +{% if argv[0] == "anonymous" %} + {% assign posts_by_author = author_not_specified | concat: posts_by_author %} +{% endif %} +{% assign return = posts_by_author | sort: "date" | reverse %} diff --git a/_includes/slnum.html b/_includes/slnum.html new file mode 100644 index 0000000..a8c3469 --- /dev/null +++ b/_includes/slnum.html @@ -0,0 +1,11 @@ +{% comment %} argv: stevilo,niz0,niz1,niz2,niz34 {% endcomment %} +{% assign argv[0] = argv[0] | modulo: 100 %} +{% if argv[0] == "1" %} + {% assign return = argv[2] %} +{% elsif argv[0] == "2" %} + {% assign return = argv[3] %} +{% elsif argv[0] == "4" or argv[0] == "3" %} + {% assign return = argv[4] %} +{% else %} + {% assign return = argv[1] %} +{% endif %} diff --git a/_layouts/author.html b/_layouts/author.html index 7c5cddc..44e62e5 100644 --- a/_layouts/author.html +++ b/_layouts/author.html @@ -11,14 +11,9 @@ layout: default <h2>objave:</h2> <ul> - {% assign filtered_posts = site.posts | where: "author", page.short_name %} - {% assign author_not_specified = site.posts | where: 'author', nil %} - {% if page.short_name == "anonymous" %} - {% assign filtered_posts = - author_not_specified | concat: filtered_posts %} - {% endif %} - {% assign filtered_posts = filtered_posts | sort: "date" | reverse %} - {% for post in filtered_posts %} + {% assign argv = page.short_name | split: "," %} + {% include posts_by_author.html %} + {% for post in return %} <li> <a href="{{ post.url | remove: ".html" }}"> {{ post.title }} @ {{ post.date | date: site.short_date_format }} diff --git a/_layouts/default.html b/_layouts/default.html index a61df81..af33326 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -6,7 +6,7 @@ {{ page.title }} :: {{ site.name }} </title> <link rel=stylesheet href=/assets/css/styles.css /> - <meta name=viewport content=width=device-width,initial-scale=1.0 /> + <meta name=viewport content="width=device-width,initial-scale=1.0" /> {% feed_meta %} {% seo %} {% if jekyll.environment == "production" %} diff --git a/_layouts/post.html b/_layouts/post.html index 4e63808..0046908 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -10,14 +10,18 @@ layout: default {% assign anon = site.authors | where: 'short_name', "anonymous" | first %} - {% if author %} - <a href="{{ author.url | remove: ".html" }}"> - {{ author.name }} - </a> + <a href="{{ author.url | remove: ".html" }}">{{ author.name }}</a> {% else %} - <a href="{{ anon.url | remove: ".html" }}"> - {{ anon.name }} - </a> + <a href="{{ anon.url | remove: ".html" }}">{{ anon.name }}</a> {% endif %} + - kategorije: + {% assign i = 1 %} + {% for category in page.categories %} + {% assign i = i | plus: 1 %} + <a href="/kategorije#{{ category }}">{{ category }}</a>{% + if i < page.categories.size %}, {% elsif i == page.categories.size %} + in + {% endif %}{% endfor %}. </p> {{ content }} diff --git a/_posts/2020-11-05-prva-objava.md b/_posts/2020-11-05-prva-objava.md index 190a617..a6ee19d 100644 --- a/_posts/2020-11-05-prva-objava.md +++ b/_posts/2020-11-05-prva-objava.md @@ -1,6 +1,7 @@ --- author: anton title: prva objava +categories: objava test --- To je prva objava na tem blogu. Kmalu pričakujte več vsebine. diff --git a/_posts/2020-11-06-druga-objava.md b/_posts/2020-11-06-druga-objava.md new file mode 100644 index 0000000..e4465ba --- /dev/null +++ b/_posts/2020-11-06-druga-objava.md @@ -0,0 +1,8 @@ +--- +author: anton +title: druga objava +categories: test +--- +To je druga objava na tem blogu. Kmalu pričakujte več vsebine. + +Adijo! diff --git a/kategorije.html b/kategorije.html new file mode 100644 index 0000000..f14da95 --- /dev/null +++ b/kategorije.html @@ -0,0 +1,33 @@ +--- +layout: default +title: kategorije +--- +<h1> + kategorije +</h1> +<h2> + {% assign argv = ",kategorij,kategorija,kategoriji,kategorije" | prepend: site.categories.size | split: "," %} + {{ site.categories.size }} {% include slnum.html %} {{ return }} +</h2> +<ul> + {% assign cats = site.categories | sort %} + {% for category in cats reversed %} <!-- 0 je ime, 1 je array objav --> + <li> + <h3 id="{{ category[0] }}"> + {{ category[0] }} + </h3> + <p> + <b> + {% assign argv = ",objav,objava,objavi,objave" | prepend: category[1].size | split: "," %} + {{ category[1].size }} <!--{% include slnum.html %}-->{{ return }}: + </b> + {% assign i = 1 %} + {% for post in category[1] %} + <a href="{{ post.url }}">{{ post.title }} @ {{ post.date | date: site.short_date_format }}</a>{% assign i = i | plus: 1 %}{% if i < category[1].size %}, + {% elsif i == category[1].size %} + in + {% endif %}{% endfor %}. + </p> + </li> + {% endfor %} +</ul> |