Skip to content

Commit

Permalink
Work out reorganization of blog.
Browse files Browse the repository at this point in the history
  • Loading branch information
donald-pinckney committed Nov 29, 2018
1 parent 1e08709 commit 253290f
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 73 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ author:
email: [email protected]

paginate: 5
paginate_path: "/blog/page:num/"

# Custom vars
social:
Expand Down
14 changes: 12 additions & 2 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ <h1>
<div class="horizontal-item">
</div>
{% assign bu = site.baseurl | append: "/" %}
{% assign blog_bu = site.baseurl | append: "/blog/" %}

<a class="horizontal-item sidebar-nav-item{% if page.url == bu %} active{% endif %}" href="{{ site.baseurl }}/">Home</a>

<a class="horizontal-item sidebar-nav-item{% if page.url == blog_bu or page.layout == 'post' or page.layout == 'bookpost' %} active{% endif %}" href="{{ site.baseurl }}/blog/">Blog Posts</a>

{% comment %}
The code below dynamically generates a sidebar nav of pages with
`layout: page` in the front-matter. See readme for usage.
Expand All @@ -23,8 +28,13 @@ <h1>
{% assign pages_list = site.pages %}
{% for node in pages_list %}
{% if node.title != null and node.sortBelow != true %}
{% if node.layout == "page" %}
<a class="horizontal-item sidebar-nav-item{% if page.url == node.url %} active{% endif %}" href="{{ node.url }}">{{ node.title }}</a>
{% if (node.layout == "page") %}
{% if page.url == node.url %}
{% assign activity = "active" %}
{% else %}
{% assign activity = "" %}
{% endif %}
<a class="horizontal-item sidebar-nav-item {{ activity }}" href="{{ node.url }}">{{ node.title }}</a>
{% endif %}
{% endif %}
{% endfor %}
Expand Down
54 changes: 54 additions & 0 deletions _layouts/blogfeed_layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
layout: default
---

<div class="posts">
{% for post in paginator.posts %}
<div class="post">
<h1 class="post-title">
<a href="{{ post.url }}" class="titular">
{{ post.title }}
</a>
</h1>

<span class="post-date">{{ post.date | date_to_string }}</span>

{% if post.excerptShowsAll %}
{{ post.content }}
{% else %}
{% assign BREAK_SIZE = 50 %}

{% assign con = post.content | strip_html | lstrip %}
{{ con | markdownify | truncatewords: BREAK_SIZE }}
<!-- {% assign pars = con | newline_to_br | split: "<br />" %}
{% assign firstP = pars.first %}
{% assign shortFirst = firstP | truncatewords: BREAK_SIZE %}
{% if shortFirst != firstP %}
{{ con | markdownify | truncatewords: BREAK_SIZE }}
{% else %}
{{ firstP }}
{% endif %} -->
{% endif %}

</div>
{% endfor %}
</div>


<div class="pagination">
{% if paginator.next_page %}
<a class="pagination-item older" href="{{ site.baseurl }}/blog/page{{paginator.next_page}}">Older</a>
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if paginator.previous_page %}
{% if paginator.page == 2 %}
<a class="pagination-item newer" href="{{ site.baseurl }}/blog/">Newer</a>
{% else %}
<a class="pagination-item newer" href="{{ site.baseurl }}/blog/page{{paginator.previous_page}}">Newer</a>
{% endif %}
{% else %}
<span class="pagination-item newer">Newer</span>
{% endif %}
</div>
19 changes: 0 additions & 19 deletions _posts/2017-06-06-content-coming-soon.md

This file was deleted.

4 changes: 3 additions & 1 deletion ml.md → _posts/ml/2017-01-01-ml-resources.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
layout: page
layout: post
title: ML Resources
isEditable: true
categories: [Machine Learning]
date: 2017-01-01
---

Easily the best way to improve at machine learning is to just get practice at it. Practice helps you improve at machine learning in two ways:
Expand Down
4 changes: 4 additions & 0 deletions blog/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
layout: blogfeed_layout
title: Blog Posts
---
3 changes: 2 additions & 1 deletion categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

<h3 class="category-head">{{ category_name }}</h3>
<a name="{{ category_name | slugize }}"></a>
{% for post in site.categories[category_name] %}
{% assign category_ls = site.categories[category_name] | reverse %}
{% for post in category_ls %}
<article class="archive-item">
<h4><a href="{{ site.baseurl }}{{ post.url }}">{{post.title}}</a></h4>
</article>
Expand Down
51 changes: 1 addition & 50 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,4 @@
title: Home
---

<div class="posts">
{% for post in paginator.posts %}
<div class="post">
<h1 class="post-title">
<a href="{{ post.url }}" class="titular">
{{ post.title }}
</a>
</h1>

<span class="post-date">{{ post.date | date_to_string }}</span>

{% if post.excerptShowsAll %}
{{ post.content }}
{% else %}
{% assign BREAK_SIZE = 50 %}

{% assign con = post.content | strip_html | lstrip %}
{{ con | markdownify | truncatewords: BREAK_SIZE }}
<!-- {% assign pars = con | newline_to_br | split: "<br />" %}
{% assign firstP = pars.first %}
{% assign shortFirst = firstP | truncatewords: BREAK_SIZE %}
{% if shortFirst != firstP %}
{{ con | markdownify | truncatewords: BREAK_SIZE }}
{% else %}
{{ firstP }}
{% endif %} -->
{% endif %}

</div>
{% endfor %}
</div>


<div class="pagination">
{% if paginator.next_page %}
<a class="pagination-item older" href="{{ site.baseurl }}/page{{paginator.next_page}}">Older</a>
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if paginator.previous_page %}
{% if paginator.page == 2 %}
<a class="pagination-item newer" href="{{ site.baseurl }}/">Newer</a>
{% else %}
<a class="pagination-item newer" href="{{ site.baseurl }}/page{{paginator.previous_page}}">Newer</a>
{% endif %}
{% else %}
<span class="pagination-item newer">Newer</span>
{% endif %}
</div>
This is my site!

0 comments on commit 253290f

Please sign in to comment.