Navigation Menu

Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Add support for sub-organization specific themes
Browse files Browse the repository at this point in the history
By default website will just be affiliated with GSA/TTS. If you set the
suborg key in override.yml to 18F, 18F branding will be used in the
footer. Other sub-organizations can be added in similar fashion.

Configuration is read in this order, last wins:
- _config.yml
- override.yml
- YAML directly in _data
- YAML in _data/suborgs/[18F, etc.]
- YAML in _data/override
  • Loading branch information
ryanhofdotgov committed Aug 28, 2020
1 parent bcf8177 commit 3020dc6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
5 changes: 5 additions & 0 deletions _data/suborgs/18F/usa_anchor.yml
@@ -0,0 +1,5 @@
site_email: 18F@gsa.gov
org_secondary: 18F
org_secondary_logo: 18f-logo-blue.svg
org_secondary_url: https://18f.gsa.gov
org_secondary_bio: "18F partners with agencies to improve the user experience of government services by helping them build and buy technology."
7 changes: 1 addition & 6 deletions _data/usa_anchor.yml
@@ -1,5 +1,4 @@
site_name: 18F UX Guide
site_email: 18F@gsa.gov
site_email: tts-info@gsa.gov
agency: U.S. General Services Administration
agency_acronym: GSA
agency_logo: gsa-logo-blue.svg
Expand All @@ -8,10 +7,6 @@ agency_about_url: https://www.gsa.gov/about
org_primary: Technology Transformation Services
org_primary_url: https://www.gsa.gov/tts/
org_primary_bio: "As part of GSA’s Technology Transformation Services (TTS), we apply modern methodologies and technologies to improve the public’s experience with government. We help agencies make their services more accessible, efficient, and effective with modern applications, platforms, processes, personnel, and software solutions."
org_secondary: 18F
org_secondary_logo: 18f-logo-blue.svg
org_secondary_url: https://18f.gsa.gov
org_secondary_bio: "18F partners with agencies to improve the user experience of government services by helping them build and buy technology."
foia_request_url: "https://www.gsa.gov/reference/freedom-of-information-act-foia"
fraud_waste_abuse_url: "https://www.gsaig.gov/"
no_fear_act_url: "https://www.gsa.gov/about-us/organization/office-of-civil-rights/notification-and-federal-employee-antidiscrimination-and-retaliation-act-of-2002"
Expand Down
14 changes: 10 additions & 4 deletions _plugins/override.rb
Expand Up @@ -6,23 +6,29 @@ module Jekyll
# Loads 18F/uswds-jekyll YAML config files in OVERRIDE_DIR, overriding any keys found in _data.

class OverrideGenerator < Generator
OVERRIDE_DIR = '_data/override/'
OVERRIDE_DIR = File.join("_data", "override")
SUBORGS_DIR = File.join("_data", "suborgs")

safe true

def generate(site)
yamls = ['header', 'navigation', 'footer', 'theme', 'usa_anchor']
yamls.each do |y|
self.merge(site, y)
if site.config['suborg']
self.merge(site, File.join(SUBORGS_DIR, site.config['suborg']), y)
end
self.merge(site, OVERRIDE_DIR, y)
end
# TODO Address favicons.yml special case
end

def merge(site, key)
def merge(site, dir, key)
begin
customizations = YAML.load_file(OVERRIDE_DIR + key + '.yml')
path = File.join(dir, key + '.yml')
customizations = YAML.load_file(path)
if customizations
site.data[key].merge!(customizations)
puts " Merged " + path
end
rescue
end
Expand Down
5 changes: 4 additions & 1 deletion override.yml
Expand Up @@ -5,6 +5,8 @@
# - url
# - github_info
# - search_site_handle
# Optional keys
# - suborg

title: Yet Another TTS Guide
description: A set of guidelines and best practices
Expand All @@ -20,4 +22,5 @@ github_info:
# usually a good site handle.
search_site_handle: yet-another-tts-guide

# This should not be merged into instantiatedsite
# Either 18F or unset
suborg: 18F

0 comments on commit 3020dc6

Please sign in to comment.