Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive and redirect content (EPIC) #8320

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions redirects/add_expirydate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
awk -F' ' '{print $2}' redirects/filepaths.txt | while IFS= read -r file; do
# Check if the file exists
if [[ -f "$file" ]]; then
# Use awk to process the front matter
if awk '
BEGIN { in_front_matter = 0 }
/^---$/ { in_front_matter++ }
in_front_matter == 1 && /^expirydate:/ { found = 1 }
in_front_matter == 2 { exit }
END { exit !found }
' "$file"; then
echo "$file: has expirydate"
else
echo "$file: false"
fi
else
echo "$file: file does not exist"
fi

# add expirydate
gsed -i'' -e '0,/---/{n;}; /^---$/ i expirydate: 2025-01-01' "${file}"
done







# ---
# slug: api-design-and-documentation
# date: 2013-03-12 12:49:20 -0400
# title: API Design and Documentation
# summary: Design At their core, developers want APIs for very straightforward, pragmatic ends. You should always design your APIs and document them with the goal of making it easier for developers to use them. Doing so results in greater adoption and a healthier, more successful API. The least efficient way to support developers would be to
# authors:
# - gray-brooks
# topics:
# - application-programming-interface
# - software-engineering
# expirydate: 2025-01-01
# ---

# ## Content goes here
15 changes: 15 additions & 0 deletions redirects/aliases_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# print all instances of the slug being used in content to review
# filepath, line-#, content copy with reference

output_file="redirects/aliases_check.txt"
> redirects/aliases_check.txt

awk '{print $1}' redirects/slugs_sort.txt | while IFS= read -r file; do
# rg -n "$file" content | choose -f ":" 0 1 2: >> redirects/aliases_check.txt
rg -n "$file" content | choose -f ":" 0 1 >> "$output_file"
done


column -t -s ' ' "$output_file" > "${output_file}.tmp" && mv "${output_file}.tmp" "$output_file"
71 changes: 71 additions & 0 deletions redirects/aliases_check.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
content/resources/connected-government-act.md 76
content/news/2013/02/2013-02-21-cdcs-solve-the-outbreak-app.md 20
content/news/2013/03/2013-03-12-api-basics.md 39
content/news/2013/03/2013-03-12-api-basics.md 41
content/news/2012/11/2012-11-05-centers-for-disease-control-content-syndication.md 23
content/news/2013/03/2013-03-12-api-design-and-documentation.md 27
content/news/2014/04/2014-04-22-government-social-media-isnt-lagging-its-different-and-thats-good.md 49
content/news/2014/04/2014-04-02-kids-gov-usability-case-study.md 33
content/about/lost-and-found-mapping-page.md 361
content/news/2015/01/2015-01-28-the-api-briefing-nasa-and-usps-explore-the-holographic-computing-frontier.md 28
content/news/2013/03/2013-03-12-resources-and-tools-for-apis.md 64
content/about/lost-and-found-mapping-page.md 522
content/news/2012/05/2012-05-07-find-free-video-stock-footage.md 17
content/guides/public-participation/facilitate-participation.md 37
content/news/2013/05/2013-05-21-developer-kit.md 182
content/news/2013/03/2013-03-12-api-design-and-documentation.md 43
content/news/2013/03/2013-03-12-resources-and-tools-for-apis.md 56
content/news/2013/03/2013-03-12-how-to-get-started-with-apis.md 134
content/news/2013/03/2013-03-12-api-design-and-documentation.md 43
content/news/2013/05/2013-05-29-mobile-application-development-program-webinar-and-wikithon-tomorrow.md 17
content/resources/connected-government-act.md 151
content/news/2013/06/2013-06-06-chief-digital-officer-roles-and-responsibilities.md 59
content/about/lost-and-found-mapping-page.md 626
content/resources/connected-government-act.md 105
content/news/2023/06/2023-06-13-how-to-choose-the-right-metrics-for-your-intranet.md 84
content/news/2023/11/2023-11-14-defining-benchmarks-and-targets-for-intranet-kpis.md 286
content/news/2023/02/2023-02-02-how-to-manage-a-federal-website.md 142
content/news/2013/08/2013-08-13-trends-on-tuesday-people-are-excited-about-mobile.md 35
content/news/2013/03/2013-03-12-api-basics.md 47
content/news/2013/08/2013-08-22-mobile-product-testing-guidelines.md 22
content/news/2013/08/2013-08-22-mobile-product-testing-guidelines.md 113
content/news/2013/08/2013-08-22-mobile-product-testing-guidelines.md 23
content/news/2013/08/2013-08-22-mobile-product-testing-guidelines.md 106
content/news/2013/08/2013-08-22-mobile-product-testing-guidelines.md 21
content/news/2013/08/2013-08-22-mobile-product-testing-guidelines.md 101
content/services/service_mobile-testing-program.md 4
content/news/2013/05/2013-05-25-functionality-and-usability-testing-resources.md 16
content/news/2013/08/2013-08-05-mobile-product-security-and-privacy-testing-resources.md 19
content/news/2013/08/2013-08-05-mobile-product-performance-testing-resources.md 16
content/news/2013/07/2013-07-31-mobile-product-accessibility-testing-resources.md 16
content/news/2023/09/2023-09-12-from-pageviews-to-progress.md 43
content/news/2013/09/2013-09-30-best-week-ever-in-socialgov-week-2.md 15
content/news/2013/11/2013-11-26-trends-on-tuesday-mobile-driving-pre-cyber-monday-shopping.md 25
content/about/lost-and-found-mapping-page.md 234
content/news/2014/02/2014-02-25-trends-on-tuesday-six-new-changes-in-kids-media-habits.md 23
content/news/2013/10/2013-10-22-tuesday-trends-lets-talk-connected-devices.md 24
content/news/2013/10/2013-10-29-tuesday-trends-12-trends-shaping-digital-news.md 23
content/news/2013/11/2013-11-05-trends-on-tuesday-mobile-surpasses-desktop-for-social-media.md 26
content/news/2013/11/2013-11-19-tuesday-trends-smartphone-shipments-achieve-highest-share-to-date.md 20
content/news/2013/11/2013-11-26-trends-on-tuesday-mobile-driving-pre-cyber-monday-shopping.md 25
content/news/2013/09/2013-09-10-trends-on-tuesday-kids-are-going-mobile.md 31
content/news/2013/09/2013-09-03-trends-on-tuesday-companies-use-mobile-for-brand-loyalty.md 15
content/news/2013/10/2013-10-17-hosting-successful-federal-twitter-chats.md 15
content/news/2013/12/2013-12-03-trends-on-tuesday-more-tablet-shipments-than-pcs-in-2014.md 19
content/resources/connected-government-act.md 77
content/news/2013/12/2013-12-03-trends-on-tuesday-more-tablet-shipments-than-pcs-in-2014.md 19
content/news/2013/10/2013-10-29-tuesday-trends-12-trends-shaping-digital-news.md 23
content/resources/connected-government-act.md 117
content/about/lost-and-found-mapping-page.md 129
content/about/lost-and-found-mapping-page.md 151
content/news/2020/05/2020-05-12-promote-continuity-better-support-customer-journeys.md 63
content/about/lost-and-found-mapping-page.md 99
content/news/2023/09/2023-09-12-from-pageviews-to-progress.md 43
content/news/2012/07/2012-07-09-how-to-improve-an-apps-challenge.md 48
content/news/2013/10/2013-10-31-creative-challenge-contests.md 20
content/about/lost-and-found-mapping-page.md 110
content/guides/public-participation/design-participation.md 30
content/news/2020/05/2020-05-12-promote-continuity-better-support-customer-journeys.md 61
content/news/2013/06/2013-06-26-making-multimedia-section-508-compliant-and-accessible.md 48
content/resources/connected-government-act.md 118
content/resources/connected-government-act.md 119
27 changes: 27 additions & 0 deletions redirects/clean_slugs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Input file containing slugs
input_file="redirects/slugs.txt"
sort_file="redirects/slugs_sort.txt"
clean_file="redirects/slugs_clean.txt"

# sort by date
cat "$input_file" | sort > "$sort_file"

# Check if the input file exists
if [[ ! -f "$sort_file" ]]; then
echo "Error: File $input_file does not exist."
exit 1
fi

# Read each line from redirects/slugs.txt
while IFS= read -r slug; do
# Skip empty lines
if [[ -z "$slug" ]]; then
continue
fi

# remove / and replace with hyphens for searching
echo "$slug" | sed 's/^\/\(.*\)\/$/\1/; s/\//-/g' >> "$clean_file"

done < "$sort_file"
166 changes: 166 additions & 0 deletions redirects/filepaths.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
files=(
"/2011/06/21/making-mobile-gov-project"
"/2011/11/28/battle-royale-mobile-web-versus-mobile-apps"
"/2012/02/19/social-data-unlocked-next-generation-services"
"/2012/02/22/dol-labor-stats-app"
"/2012/02/22/epa-indoor-airplus-app"
"/2012/02/22/my-tsa-mobile-app"
"/2012/02/24/epas-mobile-access-review-committee"
"/2012/03/05/myds-web-app"
"/2012/04/10/usa-gov-mobile-apps-gallery"
"/2012/04/25/naras-docsteach"
"/2012/04/26/noaas-release-mako-app"
"/2012/05/07/find-free-video-stock-footage"
"/2012/05/12/national-contact-centers-text-message-program"
"/2012/05/16/rimblackberry-mobile-development-webinar-recap"
"/2012/05/31/eyenote"
"/2012/06/08/usdas-ask-karen"
"/2012/06/20/medlineplus-mobile-evaluation"
"/2012/06/27/hitting-the-ground-running-with-the-digital-strategy"
"/2012/06/29/mobile-strategy-at-the-smithsonian"
"/2012/07/02/mobile-webinar-series-recap-responsive-design"
"/2012/07/09/how-to-implement-an-apps-challenge"
"/2012/07/09/how-to-improve-an-apps-challenge"
"/2012/07/11/aids-gov-responsive-design"
"/2012/07/11/faa-mobile-site"
"/2012/07/11/government-video-laws"
"/2012/07/12/bia-wikithon"
"/2012/07/13/irs2go-app"
"/2012/07/13/next-in-our-mobile-webinar-series-mobile-first"
"/2012/07/13/osha-heat-safety-tool-app"
"/2012/07/16/healthfinder-gov-api"
"/2012/07/26/introduction-to-apis"
"/2012/08/01/accessibility-editorial-guidelines-for-youtube"
"/2012/08/03/mobile-first-webinar-recap"
"/2012/08/06/how-kids-search"
"/2012/08/12/agile-sprinting-to-digital-governance-recommendations"
"/2012/08/21/sms-or-short-message-service"
"/2012/08/22/agency-digital-strategy-pages"
"/2012/08/29/digital-government-strategy-milestones-report"
"/2012/09/13/medicare-gov-responsive-redesign"
"/2012/10/01/automated-translation-good-solution-or-not"
"/2012/10/02/taking-cancer-gov-mobile"
"/2012/10/15/gsa-fedramp-usability-case-study"
"/2012/10/15/gsa-intranet-insite-usability-case-study"
"/2012/10/15/office-of-natural-resources-revenue-usability-case-study"
"/2012/10/19/feds-shed-light-on-dark-social"
"/2012/10/24/mobile-apps-life-cycle-webinar"
"/2012/10/25/gsas-child-care-information-portal"
"/2012/11/05/centers-for-disease-control-content-syndication"
"/2012/11/05/nsf-gov-usability-case-study"
"/2012/11/13/government-as-an-information-franchise"
"/2012/11/19/case-study-how-dol-created-software-development-kits-sdks"
"/2012/11/19/case-study-how-gsa-launched-social-media-registry"
"/2012/11/20/smart-traveler-app"
"/2012/11/21/how-nasa-chose-a-new-content-management-system"
"/2012/11/21/how-the-department-of-education-automated-publication-of-press-releases"
"/2012/11/30/socialgov-summit-highlights-accessibility-challenges"
"/2012/11/30/using-gamification-in-federal-projects"
"/2012/12/06/weather-gov-usability-case-study"
"/2012/12/14/irs-usability-case-study"
"/2012/12/17/sam-gov-usability-test-study"
"/2012/12/18/analytics-apis-and-open-content-resources"
"/2012/12/18/norad-tracks-santa-app"
"/2012/12/21/mobile-gov-resources-for-2013"
)

# check for existing alias already set and any refs that use them
for file in "${files[@]}"; do
# rg '/2012/05/07/find-free-video-stock-footage/' | choose 0 -f ":" >> filepaths.txt
rg "$file" | choose 0 1 2 >> filepaths.txt
done

gsed -i '/^content\/301\.md/d; /^filepaths\.sh/d' filepaths.txt

# find the markdown file path from the slug
# content/news/2012/12/2012-12-21-mobile-gov-resources-for-2013.md
# for file in "${files[@]}"; do
# find . -type f -name "*$file*"
# done


# for file in "${files[@]}"; do
# gsed -i'' -e '0,/---/{n;}; /^---$/ i expirydate: 2025-01-01' "${file}"
# done

# The expirydate: 2025-01-01 should be above the second --- like this:
# ---
# title: My First Post
# expirydate: 2025-01-01
# ---


redirect_urls=(
"/2011/06/21/making-mobile-gov-project"
"/2011/11/28/battle-royale-mobile-web-versus-mobile-apps"
"/2012/02/19/social-data-unlocked-next-generation-services"
"/2012/02/22/dol-labor-stats-app"
"/2012/02/22/epa-indoor-airplus-app"
"/2012/02/22/my-tsa-mobile-app"
"/2012/02/24/epas-mobile-access-review-committee"
"/2012/03/05/myds-web-app"
"/2012/04/10/usa-gov-mobile-apps-gallery"
"/2012/04/25/naras-docsteach"
"/2012/04/26/noaas-release-mako-app"
"/2012/05/07/find-free-video-stock-footage"
"/2012/05/12/national-contact-centers-text-message-program"
"/2012/05/16/rimblackberry-mobile-development-webinar-recap"
"/2012/05/31/eyenote"
"/2012/06/08/usdas-ask-karen"
"/2012/06/20/medlineplus-mobile-evaluation"
"/2012/06/27/hitting-the-ground-running-with-the-digital-strategy/"
"/2012/06/29/mobile-strategy-at-the-smithsonian"
"/2012/07/02/mobile-webinar-series-recap-responsive-design"
"/2012/07/09/how-to-implement-an-apps-challenge"
"/2012/07/09/how-to-improve-an-apps-challenge"
"/2012/07/11/aids-gov-responsive-design"
"/2012/07/11/faa-mobile-site"
"/2012/07/11/government-video-laws"
"/2012/07/12/bia-wikithon"
"/2012/07/13/irs2go-app"
"/2012/07/13/next-in-our-mobile-webinar-series-mobile-first"
"/2012/07/13/osha-heat-safety-tool-app"
"/2012/07/16/healthfinder-gov-api"
"/2012/07/26/introduction-to-apis"
"/2012/08/01/accessibility-editorial-guidelines-for-youtube"
"/2012/08/03/mobile-first-webinar-recap"
"/2012/08/06/how-kids-search"
"/2012/08/12/agile-sprinting-to-digital-governance-recommendations/"
"/2012/08/21/sms-or-short-message-service"
"/2012/08/22/agency-digital-strategy-pages"
"/2012/08/29/digital-government-strategy-milestones-report"
"/2012/09/13/medicare-gov-responsive-redesign"
"/2012/10/02/taking-cancer-gov-mobile"
"/2012/10/15/gsa-fedramp-usability-case-study"
"/2012/10/15/gsa-intranet-insite-usability-case-study"
"/2012/10/15/office-of-natural-resources-revenue-usability-case-study/"
"/2012/10/19/feds-shed-light-on-dark-social"
"/2012/10/24/mobile-apps-life-cycle-webinar"
"/2012/10/25/gsas-child-care-information-portal"
"/2012/11/05/centers-for-disease-control-content-syndication"
"/2012/11/05/nsf-gov-usability-case-study"
"/2012/11/13/government-as-an-information-franchise"
"/2012/11/19/case-study-how-dol-created-software-development-kits-sdks/"
"/2012/11/19/case-study-how-gsa-launched-social-media-registry/"
"/2012/11/20/smart-traveler-app"
"/2012/11/21/how-nasa-chose-a-new-content-management-system"
"/2012/11/21/how-the-department-of-education-automated-publication-of-press-releases/"
"/2012/11/30/socialgov-summit-highlights-accessibility-challenges/"
"/2012/11/30/using-gamification-in-federal-projects"
"/2012/12/06/weather-gov-usability-case-study"
"/2012/12/14/irs-usability-case-study"
"/2012/12/17/sam-gov-usability-test-study"
"/2012/12/18/analytics-apis-and-open-content-resources"
"/2012/12/18/norad-tracks-santa-app"
"/2012/12/21/mobile-gov-resources-for-2013"
)

for url in "${redirect_urls[@]}"; do
# curl -s -o /dev/null -w '%{http_code}' "https://federalist-466b7d92-5da1-4208-974f-d61fd4348571.sites.pages.cloud.gov/preview/gsa/digitalgov.gov/nl-redirect-2012-content${url}"
echo "$url, $(curl -s -o /dev/null -w '%{http_code}' "https://federalist-466b7d92-5da1-4208-974f-d61fd4348571.sites.pages.cloud.gov/preview/gsa/digitalgov.gov/nl-redirect-2012-content${url}")"
done


# curl -s -o /dev/null -w '%{http_code}' https://federalist-466b7d92-5da1-4208-974f-d61fd4348571.sites.pages.cloud.gov/preview/gsa/digitalgov.gov/nl-redirect-2012-content2012/12/18/norad-tracks-santa-app
# echo "$url, $(curl -s -o /dev/null -w '%{http_code}' "https://federalist-466b7d92-5da1-4208-974f-d61fd4348571.sites.pages.cloud.gov/preview/gsa/digitalgov.gov/nl-redirect-2012-content2012/12/18/norad-tracks-santa-app")"

Loading
Loading