Skip to content

Commit

Permalink
Merge pull request 18F#521 from 18F/bh-sort-homepage-1
Browse files Browse the repository at this point in the history
Use data file to define custom homepage category sort order
  • Loading branch information
kfoley-18F authored Apr 18, 2020
2 parents f64c2c9 + ebe805a commit 6c79bf9
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 19 deletions.
1 change: 0 additions & 1 deletion _categories/animals.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: animals
title: "Animals"
owner: CDC
homepage_order: 16
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: basics
title: "About COVID-19"
owner: CDC
homepage_order: 17
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/community-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: community-events
title: "Community events"
owner: CDC
homepage_order: 9
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/financial-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: financial-help
title: "Financial help for workers and families"
owner: Treasury
homepage_order: 5
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/funerals.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: funerals
title: "Funerals"
owner: CDC
homepage_order: 19
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/k12-childcare.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: k12-childcare
title: "K-12 schools and childcare program administrators"
owner: CDC
homepage_order: 10
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/keeping-home-safe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: keeping-home-safe
title: "Keeping your home safe"
owner: CDC
homepage_order: 4
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/parents-and-children.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: parents-and-children
title: "Parents and children"
owner: CDC
homepage_order: 6
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/pregnancy.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: pregnancy
title: "Pregnancy"
owner: CDC
homepage_order: 7
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/protect-yourself.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: protect-yourself
title: "How to protect yourself"
owner: CDC
homepage_order: 13
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/retirement-communities.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: retirement-communities
title: "Retirement communities and independent living facilities"
owner: CDC
homepage_order: 15
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/rumors.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: rumors
title: "Rumor control"
owner: FEMA
homepage_order: 12
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/spread.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: spread
title: "How it spreads"
owner: CDC
homepage_order: 2
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/support-for-business.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: support-for-business
title: "Support for businesses"
owner: Treasury
homepage_order: 8
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
1 change: 0 additions & 1 deletion _categories/symptoms-and-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: symptoms-and-testing
title: "Symptoms and testing"
owner: CDC
homepage_order: 1
banner:
display: true
heading: "Call your doctor"
Expand Down
1 change: 0 additions & 1 deletion _categories/travel.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: travel
title: "Traveling"
owner: CDC
homepage_order: 3
banner:
display: true
heading: "State or local governments may have issued orders or provided additional guidance."
Expand Down
1 change: 0 additions & 1 deletion _categories/underlying-conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: underlying-conditions
title: "Underlying conditions"
owner: CDC
homepage_order: 14
banner:
display: false
heading: "Call your doctor"
Expand Down
1 change: 0 additions & 1 deletion _categories/water-transmission.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout: category
name: water-transmission
title: "Water transmission"
owner: CDC
homepage_order: 11
banner:
display: false
heading: "This is a place to place urgent information"
Expand Down
19 changes: 19 additions & 0 deletions _data/homepage_order.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
categories:
- name: symptoms-and-testing
- name: spread
- name: travel
- name: keeping-home-safe
- name: financial-help
- name: parents-and-children
- name: pregnancy
- name: support-for-business
- name: community-events
- name: k12-childcare
- name: water-transmission
- name: rumors
- name: protect-yourself
- name: underlying-conditions
- name: retirement-communities
- name: animals
- name: basics
- name: funerals
7 changes: 6 additions & 1 deletion _includes/content-questions.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{% assign categories = site.content | group_by:"category" %}
{% assign display_categories = site.categories | sort: "homepage_order" %}
{% assign display_categories = '' | split: '' %}

{% for category in site.data.homepage_order.categories %}
{% assign sorted_category = site.categories | where:"name", category.name %}
{% assign display_categories = display_categories | push: sorted_category[0] %}
{% endfor %}

<section class="grid-container usa-section usa-section--condensed border-top border-base-lightest">
<div class="grid-row grid-gap top-categories">
Expand Down
9 changes: 9 additions & 0 deletions admin/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ collections:
- {label: 'Question', name: 'question', widget: 'string'}
- {label: 'Link to answer', name: 'link', widget: 'string'}
- {label: 'View all link', name: 'view_all_link', widget: 'string'}
- label: 'Sorted categories on homepage'
name: "homepage_order"
file: "_data/homepage_order.yml"
fields:
- label: "Categories"
name: "categories"
widget: "list"
fields:
- {label: 'Category name', name: 'name', widget: 'string'}
- label: Categories
name: categories
folder: _categories/
Expand Down

0 comments on commit 6c79bf9

Please sign in to comment.