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

Meta tag, Open Graph, and Twitter sharing metadata problems #203

Open
daveverwer opened this issue Jan 14, 2023 · 3 comments · May be fixed by #274
Open

Meta tag, Open Graph, and Twitter sharing metadata problems #203

daveverwer opened this issue Jan 14, 2023 · 3 comments · May be fixed by #274
Assignees
Labels
bug Something isn't working

Comments

@daveverwer
Copy link
Collaborator

daveverwer commented Jan 14, 2023

As part of looking over whether we should merge #162, I noticed we have some problems with how we are using our meta tags, including Open Graph and Twitter tags.

When people share URLs from Swift.org, they currently use the site description for the Open Graph and Twitter meta tags, meaning the Mentorship page previews using the site title and site description:

Screenshot 2023-01-14 at 19 03 21@2x

There are several things we could do better:

  • Tweak the conditional meta tags around lines 36 and 49 of base.html, only falling back to the site title and description when absolutely nothing else is available.
  • Attempt to get auto-excerpts working for pages that are not blog posts. I’m not quite sure how they are working for blog posts right now since we don’t use an excerpt_separator. This needs a little investigation.
  • Every page should already have a sensible title, so even without automated excerpts, we should change it so we use the page title in Open Graph and Twitter meta tags.
  • Stretch Goal: We should consider adding custom explicit excerpts for pages that get linked to a lot, like the workgroup pages, getting started, and community pages.
@daveverwer daveverwer added the bug Something isn't working label Jan 14, 2023
@dempseyatgithub
Copy link
Collaborator

  • Attempt to get auto-excerpts working for pages that are not blog posts. I’m not quite sure how they are working for blog posts right now since we don’t use an excerpt_separator. This needs a little investigation.

Looking at the jekyll docs, the first paragraph of a blog post is automatically used as an excerpt even without using the excerpt_separator.

Excerpts for pages can be enabled by setting page_excerpts to true in the config file for Jekyll 4.1.1 and later, so we should be able to use it.

@dempseyatgithub
Copy link
Collaborator

I just started working on this so am assigning to myself.

@dempseyatgithub dempseyatgithub self-assigned this Mar 26, 2023
@dempseyatgithub
Copy link
Collaborator

Making progress. I have automated page excerpts working in my fork.

For some pages an explicit excerpt will be required, not just a 'nice to have'. Two examples: Downloads, where the first paragraph is blank, so the excerpt is an empty string. Blog, where the automatic excerpt includes all of the blog posts, making for a gigantic excerpt.

dempseyatgithub added a commit to dempseyatgithub/swift-org-website that referenced this issue Mar 30, 2023
- In _config.yml file:
  - Enable page excerpts
  - Set excerpt separator
- In base layout:
  - Calculate title, description, URL in one place for meta tags
  - Always use page values for meta tags when present, fallback to site values
  - Replace conditional tags with single tag that uses calculated value
  - Move robots meta tag out from the middle of Open Graph tags
  - Reduce excessive whitespace from generated newlines
- Add explicit excerpts to front matter of pages where automatic
  excerpt was not suitable / sufficient
- Small adjustments to page first paragraphs to generate better description
  meta tags
- Resolves apple#203
dempseyatgithub added a commit to dempseyatgithub/swift-org-website that referenced this issue Mar 31, 2023
- In _config.yml file:
  - Enable page excerpts
  - Set excerpt separator
- In base layout:
  - Calculate title, description, URL in one place for meta tags
  - Always use page values for meta tags when present, fallback to site values
  - Replace conditional tags with single tag that uses calculated value
  - Move robots meta tag out from the middle of Open Graph tags
  - Reduce excessive whitespace from generated newlines
- Add explicit excerpts to front matter of pages where automatic
  excerpt was not suitable / sufficient
- Small adjustments to page first paragraphs to generate better description
  meta tags
- Resolves apple#203
@dempseyatgithub dempseyatgithub linked a pull request Mar 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants