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

Added hostname to og:url to include top level domain #7563

Merged
merged 12 commits into from
May 29, 2024
3 changes: 2 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ params:
git_org: "GSA"
git_repo: "digitalgov.gov"
devmode: false
hostName: "https://digital.gov"

# Homepage settings
dg_tagline: "Better websites. Better government."
Expand Down Expand Up @@ -157,5 +158,5 @@ menu:
Weight: 2
- Name: "Contact Us"
Identifier: "contact"
URL: "/about/contact/"
URL: "/about/contact/"
Weight: 3
5 changes: 4 additions & 1 deletion themes/digital.gov/layouts/partials/core/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@
content="{{- $.Params.summary | default $.Site.Params.description | markdownify -}}"
/>
<meta property="og:type" content="{{- $.Scratch.Get "pagetype" -}}" />
<meta property="og:url" content="{{- .Permalink -}}" />
<meta
property="og:url"
content="{{ .Site.Params.hostName }}{{- .Permalink -}}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Communities

Returns og:url value of https://digital.gov//localhost:1313/communities/.

image

In Cloud Pages preview I see a link that leads to 404:

https://federalist-466b7d92-5da1-4208-974f-d61fd4348571.sites.pages.cloud.gov/preview/gsa/digitalgov.gov/nl-fix-og-url/communities/

It should be:

https://federalist-466b7d92-5da1-4208-974f-d61fd4348571.sites.pages.cloud.gov/preview/gsa/digitalgov.gov/nl-fix-og-url/communities/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mejiaj Both of the URL's are the same in the examples above. For some reason I do not see https://www.digital.gov set on my local, still uses localhost:1313, could be a caching issue with your code suggestions.

  1. Updated baseURL: https://www.digital.gov in config.yml
  2. And set:
<meta property="og:url" content="{{- .Permalink | absURL -}}"/>

/>
<meta property="og:site_name" content="Digital.gov" />
<meta name="robots" content="index, follow" />
<meta property="og:locale" content="en_US" />
Expand Down
Loading