Skip to content

Commit ca3a1bf

Browse files
authored
Merge pull request TheAlgorithms#1123 from ZakCodes/collections
Use collections for the sections of the site
2 parents d4159b6 + 061dabe commit ca3a1bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+13
-16
lines changed

_config.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ exclude:
1616
- node_modules
1717
keep_files: ["css"]
1818

19+
# Collections
20+
collections:
21+
basics:
22+
output: true
23+
tags:
24+
output: true
25+
filters:
26+
output: true
27+
1928
# Plugins
2029
plugins:
2130
- jekyll-redirect-from
@@ -26,11 +35,3 @@ defaults:
2635
path: "" # an empty string here means all files in the project
2736
values:
2837
layout: default
29-
- scope:
30-
path: "filters"
31-
values:
32-
type: filter
33-
- scope:
34-
path: "tags"
35-
values:
36-
type: tag

_includes/sidebar.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@
1515
<h3 class="section__header">{{ section | capitalize }}</h3>
1616

1717
<ul class="section__links">
18-
{%- for item in site.pages -%}
19-
{%- if item.url contains section/ -%}
20-
{%- unless item.path contains "index" -%}
21-
<li class="section__item">
22-
<a href="{{ item.url | relative_url }}" class="section__link {% if item.url contains page.url and page.url != '/' and page.type != 'index' %} section__link--is-active{% endif %}">{{ item.title }}</a>
23-
</li>
24-
{%- endunless -%}
25-
{%- endif -%}
18+
{%- for item in site[section] -%}
19+
<li class="section__item">
20+
<a href="{{ item.url | relative_url }}" class="section__link{% if item.url == page.url %} section__link--is-active{% endif %}">{{ item.title }}</a>
21+
</li>
2622
{%- endfor -%}
2723
</ul>
2824
{%- endfor -%}

0 commit comments

Comments
 (0)