From e6f162e9d0a91d078c6e03dc2197fca325195bb2 Mon Sep 17 00:00:00 2001 From: Brian Hurst Date: Thu, 16 Apr 2020 12:38:45 -0400 Subject: [PATCH] Use data file to define custom homepage category sort order --- _categories/animals.md | 1 - _categories/basics.md | 1 - _categories/community-events.md | 1 - _categories/financial-help.md | 1 - _categories/funerals.md | 1 - _categories/k12-childcare.md | 1 - _categories/keeping-home-safe.md | 1 - _categories/parents-and-children.md | 1 - _categories/pregnancy.md | 1 - _categories/protect-yourself.md | 1 - _categories/retirement-communities.md | 1 - _categories/rumors.md | 1 - _categories/spread.md | 1 - _categories/support-for-business.md | 1 - _categories/symptoms-and-testing.md | 1 - _categories/travel.md | 1 - _categories/underlying-conditions.md | 1 - _categories/water-transmission.md | 1 - _data/homepage_order.yml | 18 ++++++++++++++++++ _includes/content-questions.html | 7 ++++++- 20 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 _data/homepage_order.yml diff --git a/_categories/animals.md b/_categories/animals.md index c698bc258..590142dee 100644 --- a/_categories/animals.md +++ b/_categories/animals.md @@ -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" diff --git a/_categories/basics.md b/_categories/basics.md index f500b2d27..0810e3a8c 100644 --- a/_categories/basics.md +++ b/_categories/basics.md @@ -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" diff --git a/_categories/community-events.md b/_categories/community-events.md index 5405f3ecf..631cd372c 100644 --- a/_categories/community-events.md +++ b/_categories/community-events.md @@ -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" diff --git a/_categories/financial-help.md b/_categories/financial-help.md index 9fd02bfb6..c5323eb42 100644 --- a/_categories/financial-help.md +++ b/_categories/financial-help.md @@ -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" diff --git a/_categories/funerals.md b/_categories/funerals.md index cdf0e12ec..966d0be9f 100644 --- a/_categories/funerals.md +++ b/_categories/funerals.md @@ -3,7 +3,6 @@ layout: category name: funerals title: "Funerals" owner: CDC -homepage_order: 18 banner: display: false heading: "This is a place to place urgent information" diff --git a/_categories/k12-childcare.md b/_categories/k12-childcare.md index fc1575497..9dfc53b44 100644 --- a/_categories/k12-childcare.md +++ b/_categories/k12-childcare.md @@ -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" diff --git a/_categories/keeping-home-safe.md b/_categories/keeping-home-safe.md index e8905b510..beb7a8bb5 100644 --- a/_categories/keeping-home-safe.md +++ b/_categories/keeping-home-safe.md @@ -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" diff --git a/_categories/parents-and-children.md b/_categories/parents-and-children.md index b8359236f..600adaf2b 100644 --- a/_categories/parents-and-children.md +++ b/_categories/parents-and-children.md @@ -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" diff --git a/_categories/pregnancy.md b/_categories/pregnancy.md index aaaa6df59..2dbd4db33 100644 --- a/_categories/pregnancy.md +++ b/_categories/pregnancy.md @@ -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" diff --git a/_categories/protect-yourself.md b/_categories/protect-yourself.md index af3967721..b6e06b481 100644 --- a/_categories/protect-yourself.md +++ b/_categories/protect-yourself.md @@ -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" diff --git a/_categories/retirement-communities.md b/_categories/retirement-communities.md index 5c3278365..89a277db6 100644 --- a/_categories/retirement-communities.md +++ b/_categories/retirement-communities.md @@ -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" diff --git a/_categories/rumors.md b/_categories/rumors.md index a374714b4..4cb6d3555 100644 --- a/_categories/rumors.md +++ b/_categories/rumors.md @@ -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" diff --git a/_categories/spread.md b/_categories/spread.md index 0e532f76f..511f4ab24 100644 --- a/_categories/spread.md +++ b/_categories/spread.md @@ -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" diff --git a/_categories/support-for-business.md b/_categories/support-for-business.md index 3b9278bb8..43db39a4d 100644 --- a/_categories/support-for-business.md +++ b/_categories/support-for-business.md @@ -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" diff --git a/_categories/symptoms-and-testing.md b/_categories/symptoms-and-testing.md index 8360cc2e2..26bae8c86 100644 --- a/_categories/symptoms-and-testing.md +++ b/_categories/symptoms-and-testing.md @@ -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" diff --git a/_categories/travel.md b/_categories/travel.md index ee03656fd..f18382113 100644 --- a/_categories/travel.md +++ b/_categories/travel.md @@ -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." diff --git a/_categories/underlying-conditions.md b/_categories/underlying-conditions.md index 42e2dacef..6740e4603 100644 --- a/_categories/underlying-conditions.md +++ b/_categories/underlying-conditions.md @@ -3,7 +3,6 @@ layout: category name: underlying-conditions title: "Underlying conditions" owner: CDC -homepage_order: 14 banner: display: false heading: "Call your doctor" diff --git a/_categories/water-transmission.md b/_categories/water-transmission.md index 1a8bcac63..8d5f66cb3 100644 --- a/_categories/water-transmission.md +++ b/_categories/water-transmission.md @@ -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" diff --git a/_data/homepage_order.yml b/_data/homepage_order.yml new file mode 100644 index 000000000..18daa5ad3 --- /dev/null +++ b/_data/homepage_order.yml @@ -0,0 +1,18 @@ +- symptoms-and-testing +- spread +- travel +- keeping-home-safe +- financial-help +- parents-and-children +- pregnancy +- support-for-business +- community-events +- k12-childcare +- water-transmission +- rumors +- protect-yourself +- underlying-conditions +- retirement-communities +- animals +- basics +- funerals diff --git a/_includes/content-questions.html b/_includes/content-questions.html index 17fb3bc90..170657e1f 100644 --- a/_includes/content-questions.html +++ b/_includes/content-questions.html @@ -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 %} + {% assign sorted_category = site.categories | where:"name", category %} + {% assign display_categories = display_categories | push: sorted_category[0] %} +{% endfor %}