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

Search.gov Suggested Updates #467

Closed

Conversation

amanifarooque
Copy link
Contributor

Hi team,

We made a few suggested changes that were incorporated into the Jekyll template (cloud-gov/pages-uswds-jekyll#205), so we wanted to ensure they were also present in the Gatsby template for ease of use. I'm much less familiar with Gatsby/React, so please feel free to change the implementation as you see fit. We're hoping that with these changes, sites will be better set up for Search.gov indexing and display of search results.

Summary of Changes

  • Updated USWDS version for compatibility: this was required to get the site to run
  • Updated Search.gov instructional comments: these now mirror the Jekyll template
  • Added typeahead functionality to search bar: I added this mirroring the implementation for DAP and GA, but please do change if it's not ideal.
  • Removed site description as the meta description fallback: Repetitive meta descriptions can cause false matches in search, and in general do not help from an SEO perspective.
  • Fixed text highlighting in title & snippet for search results: Updated so that the matched query terms appear with a yellow highlight, as they do in the Jekyll template.
  • Added sitemap plugin (needs work): I added the plugin to generate a sitemap (gatsby-plugin-sitemap), but I wasn't able to figure out how to add last modified dates successfully. Search.gov uses the date as a trigger to index updated content, so it is important to include.
  • Added robots.txt: I added the plugin gatsby-plugin-robots-txt, which adds a robots.txt file at the root of the site. Because the sitemap is in a non-standard position, it should be listed in the robots.txt for easy finding. I also added a rule to disallow crawling for development environments, but allow on production.

Please reach out with any questions - also happy to meet if that's easier!

- updated USWDS version for compatibility
- updated Search.gov instructional comments
- added typeahead functionality to search bar
- removed site description as the meta description fallback
- fixed text highlighting in title & snippet for search results
- added robots.txt
- added sitemap plugin (needs work)
document.body.appendChild(config);

const src="https://search.usa.gov/javascripts/remote.loader.js";
const onLoad = () => console.log("Typeahead suggestions loaded.");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need anything to happen onLoad, but I put this in as a placeholder. Feel free to remove.

gatsby-config.js Outdated Show resolved Hide resolved
gatsby-config.js Outdated Show resolved Hide resolved
gatsby-config.js Outdated Show resolved Hide resolved
gatsby-config.js Outdated Show resolved Hide resolved
Copy link

@dawnpm dawnpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Amani, a few tweaks please. Thanks!

@dawnpm
Copy link

dawnpm commented Dec 2, 2021

Thanks @amanifarooque - I would add that the big commercial engines also trigger off of lastmod dates in sitemaps, so it will be win-win to have those in the standard sitemap.

@hursey013
Copy link
Contributor

Closed via #475, thanks @amanifarooque and @dawnpm!

@hursey013 hursey013 closed this Mar 11, 2022
@amanifarooque
Copy link
Contributor Author

Thank you @hursey013! The two outstanding items that I couldn't figure out were:

  1. Adding to the sitemap
  2. Listing the sitemap in the robots.txt file

Should I open issues for these?

@hursey013
Copy link
Contributor

@amanifarooque apologies, I missed your notes about the sitemap - yes, if you don't mind creating an issue with some additional detail I'd be glad to take a look at it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants