diff options
| author | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-17 20:40:19 +0100 |
|---|---|---|
| committer | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-17 21:01:48 +0100 |
| commit | a7816c160e06b2ee7684dcb66e1480cfcde0e90a (patch) | |
| tree | e9774271cb36b8102a3a705661c11ec247ab8fd7 | |
| parent | 15416ecb2d7b0a38eae59385a600a7e27cd59110 (diff) | |
| download | wiki-a7816c160e06b2ee7684dcb66e1480cfcde0e90a.tar.gz wiki-a7816c160e06b2ee7684dcb66e1480cfcde0e90a.tar.bz2 wiki-a7816c160e06b2ee7684dcb66e1480cfcde0e90a.zip | |
Improved blog feature and other minor fixes
| -rw-r--r-- | 404.md | 2 | ||||
| -rw-r--r-- | _config.yml.dist | 9 | ||||
| -rw-r--r-- | _includes/git-wiki/components/lists/post-list.html | 6 | ||||
| -rw-r--r-- | _layouts/git-wiki-blog.html | 57 | ||||
| -rw-r--r-- | _layouts/git-wiki-post.html | 15 | ||||
| -rw-r--r-- | _sass/git-wiki-style.scss | 7 | ||||
| -rw-r--r-- | blog/index.html | 4 |
7 files changed, 94 insertions, 6 deletions
@@ -1,6 +1,6 @@ --- permalink: /404.html -layout: "null" +layout: null --- <!-- redirect to page creator if not exists --> diff --git a/_config.yml.dist b/_config.yml.dist index bbea686..bd8b83e 100644 --- a/_config.yml.dist +++ b/_config.yml.dist @@ -12,6 +12,9 @@ blog_feature: true show_wiki_posts: true
# (integer) Maximum number of wiki posts to shown in sidebar
show_wiki_posts_limit: 10
+# from jekyll (read jekyll doc)
+paginate: 5
+paginate_path: "/blog/page:num"
# (boolean) Enable/disable download buttons in sidebar
show_downloads: true
# (string) Specify branch rendered by gitpages allowing wiki tool buttons to work
@@ -60,6 +63,12 @@ defaults: type: "pages"
values:
layout: "git-wiki-default"
+ -
+ scope:
+ path: ""
+ type: "posts"
+ values:
+ layout: "git-wiki-post"
sass:
style: compressed
plugins:
diff --git a/_includes/git-wiki/components/lists/post-list.html b/_includes/git-wiki/components/lists/post-list.html index 5e39359..be1aa35 100644 --- a/_includes/git-wiki/components/lists/post-list.html +++ b/_includes/git-wiki/components/lists/post-list.html @@ -2,12 +2,12 @@ {% include {{ site.inc_before_post_list }} %} {% endif %} -<span class="post-list-title">Posts {% if (site.show_wiki_post_limit >= 1 %} (Latest {{site.show_wiki_post_limit }} updated) {% endif %}:</span> +<span class="post-list-title">Posts {% if (site.show_wiki_posts_limit >= 1 %} (Latest {{site.show_wiki_posts_limit }} updated) {% endif %}:</span> <ul class="post-list"> {% assign numPages=0 %} {% assign items = site.posts | sort: 'date' %} {% for post in items %} -{% if numPages >= site.show_wiki_post_limit %} +{% if numPages >= site.show_wiki_posts_limit %} {% break %} {% endif %} @@ -21,6 +21,8 @@ {% endfor %} </ul> +<span class="post-list read-all"><a href="{{ '/blog/' | relative_url}}">Read all</a></span> + {% if site.inc_after_post_list %} {% include {{ site.inc_after_post_list }} %} {% endif %}
\ No newline at end of file diff --git a/_layouts/git-wiki-blog.html b/_layouts/git-wiki-blog.html new file mode 100644 index 0000000..1241770 --- /dev/null +++ b/_layouts/git-wiki-blog.html @@ -0,0 +1,57 @@ +--- +title: Blog +layout: git-wiki-default +--- +<style> +.pagination a, .pagination span { + padding: 7px 18px; + border: 1px solid #eee; + margin-left: -2px; + margin-right: -2px; + background-color: #ffffff; + display: inline-block; + } + +.pagination a { + &:hover { + background-color: #f1f1f1; + color: #333; + } + } + +.pagination { + text-align: center; + } +</style> + +<!-- This loops through the paginated posts --> +{% for post in paginator.posts %} + <h1><a href="{{ post.url }}">{{ post.id }}</a></h1> + <p class="author"> + <span class="date">{{ post.date | date: "%-d %B %Y"}}</span> + </p> + <div class="content"> + {{ post.excerpt }} + + <a href="{{ post.url }}">...Read all</a> + </div> +{% endfor %} + +<!-- Pagination links --> +<div class="pagination"> + {% if paginator.previous_page %} + <a href="{{ paginator.previous_page_path }}" class="previous"> + Previous + </a> + {% else %} + <span class="previous">Previous</span> + {% endif %} + <span class="page_number "> + Page: {{ paginator.page }} of {{ paginator.total_pages }} + </span> + {% if paginator.next_page %} + <a href="{{ paginator.next_page_path }}" class="next">Next</a> + {% else %} + <span class="next ">Next</span> + {% endif %} +</div>
\ No newline at end of file diff --git a/_layouts/git-wiki-post.html b/_layouts/git-wiki-post.html new file mode 100644 index 0000000..3184199 --- /dev/null +++ b/_layouts/git-wiki-post.html @@ -0,0 +1,15 @@ +--- +layout: git-wiki-default +--- + +<small>{{ page.date | date: "%-d %B %Y" }}</small> +{% if page.author or site.author %} +<p class="view">by {{ page.author | default: site.author }}</p> +{% endif %} + +{{content}} + + +{% if page.tags.size > 0 %} + <small>tags: <em>{{ page.tags | join: "</em> - <em>" }}</em></small> +{% endif %}
\ No newline at end of file diff --git a/_sass/git-wiki-style.scss b/_sass/git-wiki-style.scss index c40fd08..e3fb194 100644 --- a/_sass/git-wiki-style.scss +++ b/_sass/git-wiki-style.scss @@ -107,11 +107,12 @@ img { header { width: 272px; float: left; - position: fixed; + /*position: fixed;*/ -webkit-font-smoothing: subpixel-antialiased; - overflow-y: auto; - overflow-x: auto; + /*overflow-y: auto; + overflow-x: auto;*/ max-height: 100%; + margin-bottom: 30px; } header .downloads { diff --git a/blog/index.html b/blog/index.html new file mode 100644 index 0000000..f806d66 --- /dev/null +++ b/blog/index.html @@ -0,0 +1,4 @@ +--- +layout: git-wiki-blog +--- + |
