Skip to content

Commit

Permalink
Updating code for two snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonnrosa committed Jun 3, 2019
1 parent fcbf6a7 commit c287cb3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
Binary file modified Assets/Images/blogNumberedPagination.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 12 additions & 5 deletions Snippets/blogPagination/numbered/blogPaginationNumbered.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
/* Numbered Pagination */
.blog-pagination {
display: block;
text-align: center;
}
.blog-pagination > div {
display: inline-block;
}
.blog-pagination a {
color: #000;
text-decoration: none;
}
.blog-pagination-left {
text-align: right;
}
.blog-pagination-right {
text-align: left;
}
.blog-pagination a {
display: inline-block;
text-align: center;
border-radius: 4px;
display: inline-block;
padding: 5px 10px;
text-align: center;
}
.blog-pagination a:hover,
.blog-pagination a:focus {
Expand All @@ -33,12 +36,16 @@
cursor: default;
}
.blog-pagination a.next-link,
.blog-pagination a.prev-link {
.blog-pagination a.prev-link,
.blog-pagination a.last-link,
.blog-pagination a.first-link{
background-color: #666;
color: #fff;
}
.blog-pagination a.next-link:hover,
.blog-pagination a.prev-link:hover {
.blog-pagination a.prev-link:hover,
.blog-pagination a.last-link:hover,
.blog-pagination a.first-link:hover{
background-color: #008cd4;
color: #fff;
}
21 changes: 8 additions & 13 deletions Snippets/blogPagination/numbered/blogPaginationNumbered.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- Numbered Pagination -->
<div class="blog-pagination">
{% set page_list = [-2, -1, 0, 1, 2] %}
{% if contents.total_page_count - current_page_num == 1 %}{% set offset = -1 %}
Expand All @@ -8,14 +7,12 @@
{% else %}{% set offset = 0 %}{% endif %}

<div class="blog-pagination-left">
{% if last_page_num %}<a class="prev-link" href="{{ blog_page_link(last_page_num) }}"></a>{% endif %}
{% if contents.total_page_count > 5 %}
{% if current_page_num >= 4 %}
<a href="{{ blog_page_link(1) }}">1</a>
<a class="elipses" href="{% if current_page_num <= 5 %}{{ blog_page_link(1) }}{% else %}{{ blog_page_link(current_page_num - 5) }}{% endif %}">...</a>
{% endif %}
{% if current_page_num >= 3 %}
<a class="first-link" href="{{ blog_page_link(1) }}">❮❮</a>
{% endif %}
{% if last_page_num %}<a class="prev-link" href="{{ blog_page_link(last_page_num) }}"></a>{% endif %}
</div>

<div class="blog-pagination-center">
{% for page in page_list %}
{% set this_page = current_page_num + page + offset %}
Expand All @@ -24,13 +21,11 @@
{% endif %}
{% endfor %}
</div>

<div class="blog-pagination-right">
{% if contents.total_page_count > 5 %}
{% if contents.total_page_count - current_page_num > 2 %}
<a class="elipses" href="{% if contents.total_page_count - current_page_num <= 5 %}{{ contents.total_page_count }}{% else %}{{ blog_page_link(current_page_num + 5) }}{% endif %}">...</a>
<a href="{{ blog_page_link(contents.total_page_count) }}">{{ contents.total_page_count }}</a>
{% endif %}
{% endif %}
{% if next_page_num %}<a class="next-link" href="{{ blog_page_link(current_page_num + 1) }}"></a>{% endif %}
{% if contents.total_page_count - current_page_num >= 2 %}
<a class="last-link" href="{{ contents.total_page_count }}">❯❯</a>
{% endif %}
</div>
</div>
2 changes: 1 addition & 1 deletion Snippets/blogTopicTitle/blogTopicTitle.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if topic %}
{% set string_to_split = content.title %}
{% set string_to_split = content.title %}
{% set newArray = string_to_split|split('|', 2) %}
{% for item in newArray %}
{% if loop.last %}
Expand Down
23 changes: 11 additions & 12 deletions Snippets/blogTopicTitle/readme.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Printing the Blog Topic Title on a Topic Page

**Purpose:** to pull the topic name onto the corresponding topic page of a blog.
**Purpose:** to pull the topic name onto the corresponding topic page of a blog.

## Instructions
## Instructions

Add the following code inside of the {% for topic %} loop where you want the topic title to show.
Add the following code inside of the {% if topic %} conditional where you want the topic title to show.

```html
{% set string_to_split = content.title %}
{% set newArray = string_to_split|split('|', 2) %}
{% for item in newArray %}
{% if loop.last %}
<h2 style="text-align: center;">{{ item }}</h2>
{% endif %}
{% endfor %}
```html
{% set string_to_split = content.title %}
{% set newArray = string_to_split|split('|', 2) %}
{% for item in newArray %}
{% if loop.last %}
<h2 style="text-align: center;">{{ item }}</h2>
{% endif %}
{% endfor %}
```

0 comments on commit c287cb3

Please sign in to comment.