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

Fix html headers #943

Merged
merged 5 commits into from
Mar 19, 2024
Merged

Fix html headers #943

merged 5 commits into from
Mar 19, 2024

Conversation

TomNUSDS
Copy link
Contributor

@TomNUSDS TomNUSDS commented Mar 12, 2024

Changes:

  • Added two headers that were reported as missing: <meta name="robots" and <meta property="og:image:alt"
  • <meta name="robots" content="noindex, nofollow" /> was there for non-production and if the page.hide_from_search was set; however, the inverse of <meta name="robots" content="index" /> wasn't there.
  • <meta property="og:image:alt" is a 508 string. It's dynamic depending on the image being displayed. Pages will need to include a social_image_alt_text or carousel_image_alt_text with their custom images.
  • Started using{%- and -%} which removes the blank line feeds from the output. When an eng candidate might look at our source, all the blank spaces look pretty sloppy. Also, hurting code readability to prevent extra whitespace in output is an anti-pattern.
  • Move the 5x-step if/else logic out of a single line and into separate lines at the top of the file so it is readable.
  • Repeated process for other variables to be consistent.
  • Split out the application/ld+json json into multiple lines to be more readable. It is super confusing because {{ could be json OR Jekyll syntax. Fixed at least one bug related to this confusion.
  • 404 page was not set to be ignored

How I tested:

  1. On main branch, use the build or build-staging to generate the static html into _site
  2. Back up somewhere to make diff with changes easier or rename it to _site_main
  3. Switch to this branch and rebuild again.
  4. Compare outputted files focusing on html headers. (There should be no body content changes)

- Added two headers that were reported as missing: `<meta name="robots" ` and `<meta property="og:image:alt" `
- `<meta name="robots" content="noindex, nofollow" />` was there for non-production and if the `page.hide_from_search` was set; however, the inverse of `<meta name="robots" content="index" />` wasn't there.
- `<meta property="og:image:alt"` is a 508 string. It's dynamic depending on the image being displayed. Pages will need to include a `social_image_alt_text` or `carousel_image_alt_text` with their custom images.
- Started using`{%-` and `-%}` which removes the blank line feeds from the output. When an eng candidate might look at our source, all the blank spaces look pretty sloppy.
- Move the 5x-step if/else logic out of a single line and into separate lines at the top of the file so it is readable.
- Repeated process for other variables to be consistent.
- Split out the `application/ld+json` json into multiple lines to be more readable. It is super confusing because `{{` could be json OR Jekyll syntax. Fixed at least one bug related to this confusion.
@TomNUSDS TomNUSDS changed the title Fix html headers [DRAFT] Fix html headers Mar 12, 2024
@TomNUSDS TomNUSDS self-assigned this Mar 12, 2024
@TomNUSDS TomNUSDS changed the title [DRAFT] Fix html headers Fix html headers Mar 12, 2024
@TomNUSDS TomNUSDS requested a review from drew-usds March 12, 2024 19:24
_config.yml Outdated Show resolved Hide resolved
pages/apply.html Outdated Show resolved Hide resolved
pages/contact-us.html Outdated Show resolved Hide resolved
pages/events.html Outdated Show resolved Hide resolved
pages/home.html Outdated Show resolved Hide resolved
pages/how-we-work.html Outdated Show resolved Hide resolved
pages/mission.html Outdated Show resolved Hide resolved
pages/news-and-blog.html Outdated Show resolved Hide resolved
@drew-usds
Copy link
Contributor

  • @TomNUSDS @amwhitty Just drafted some alternate text for the social image alts.
  • The other edits look good and are working/testing for me a-ok!

@TomNUSDS TomNUSDS requested a review from drew-usds March 18, 2024 14:49
Copy link
Contributor

@drew-usds drew-usds left a comment

Choose a reason for hiding this comment

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

👍 Looks good! Thx!

@TomNUSDS TomNUSDS merged commit 92bd184 into master Mar 19, 2024
@TomNUSDS TomNUSDS deleted the tomn-usds/fix-html-headers branch March 28, 2024 18:58
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.

None yet

3 participants