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

feat(website): add blog social media banner #3614

Merged
merged 4 commits into from
Aug 30, 2023

Conversation

mairin
Copy link
Member

@mairin mairin commented Aug 21, 2023

What does this PR do?

This PR sets explicit featured images for individual blog posts (the most recent 5, to be exact) so when those blog post links are shared on social media, etc., they will display the image for that post in the preview.

Right now, no image is defined, so they show up blank and sad.

I also attempt to set a default, general "Podman Desktop" graphic banner to show up in the case that we don't define a featured image for any individual blog post. Also, this general banner should show up if any link on podman-desktop.io is shared and generates a preview card.

(I say "attempt" because for whatever reason, I couldn't test the default locally without using https://localhost:3000/img/banner_podman-desktop.png as the image url value... of course I'm not going to hard code that... I committed the relative path 'img/banner_podman-desktop.png' as demonstrated in the upstream docs and hoping it words in 'prod')

Screenshot/screencast of this PR

BEFORE 😭

Screenshot from 2023-08-21 11-22-50

AFTER 🥰

Screenshot from 2023-08-21 14-06-43

What issues does this PR fix or reference?

#3613

How to test this PR?

  • yarn && yarn start in the website directory of the repo
  • you need a social media previewer thing that will work with local URLs. i used this one in chrome: https://chrome.google.com/webstore/detail/social-share-preview/ggnikicjfklimmffbkhknndafpdlabib
  • Pop up the social media previewer tool and visit http://localhost:3000
  • Anywhere you go on the website should have this in the previewer:
    Screenshot from 2023-08-29 09-11-24
  • Then visit the blog... the 5 most recent posts should have banners in the social media previewer that match the image in the blog post eg
    Screenshot from 2023-08-29 09-11-34

@mairin
Copy link
Member Author

mairin commented Aug 21, 2023

I'm kinda stuck on the relative links not working locally thing, but, I don't think there's a high-penalty for it being broken - the generic preview image simply won't load, which is the status quo anyway. And once this is merged, we can always change the image url to the full link instead of the relative one.

@mairin mairin marked this pull request as ready for review August 21, 2023 18:39
@mairin mairin requested review from slemeur, themr0c, benoitf and a team as code owners August 21, 2023 18:39
@mairin mairin requested review from dgolovin and lstocchi and removed request for a team August 21, 2023 18:39
@@ -5,6 +5,7 @@ slug: podman-desktop-release-0.15
authors: [deboer]
tags: [podman-desktop, release, kubernetes, kind]
hide_table_of_contents: false
image: /assets/images/podman-desktop-release-0.15-89cd5f136ad85c15bc5b4d16a919140a.webp
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we need to move images to static folder so you can use the same name. I'm not sure how the suffix is generated here so I don't know if it can be broken after an update ?

Copy link
Member Author

Choose a reason for hiding this comment

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

So I optimized them and put them in a static folder (will push to PR after finishing this comment)... and I have no idea why but if I visit http://localhost:3000/img/blog/podman-desktop-release-1.3.webp in my browser, the image works no problem. It doesn't if I set the header in the blog post image attribute like so:

image: /img/blog/podman-desktop-release-1.3.webp

It won't display in the social preview:
Screenshot from 2023-08-27 21-53-38

If I hardcode it including http (https does not work) like so, it works:

image: http://localhost:3000/img/blog/podman-desktop-release-1.3.webp

Screenshot from 2023-08-27 21-53-25

Docusaurus is doing something weird to relative links... any ideas?

Copy link
Collaborator

Choose a reason for hiding this comment

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

AFAIK it looks like the relative image tag in the blog post are prefixed by the docusaurus URL object

I've created #3685

Copy link
Collaborator

Choose a reason for hiding this comment

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

#3685 has been merged, if you try again locally the 'social preview links should work'

Copy link
Member Author

Choose a reason for hiding this comment

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

It does!!! Thanks @benoitf !!

@benoitf benoitf changed the title Blog social media banner fix feat(website): add blog social media banner Aug 29, 2023
@benoitf
Copy link
Collaborator

benoitf commented Aug 29, 2023

@mairin I think you'll need to rebase the PR, here are 71 commits attached to this PR

@mairin
Copy link
Member Author

mairin commented Aug 29, 2023

@mairin I think you'll need to rebase the PR, here are 71 commits attached to this PR

I don't know why it does that... :-/ if i rebase from the terminal thats what happens. But if I rebase using the github UI it doesn't seem to do that. I'm not sure how to fix it :(

now if someone shares a blog post that doesn't have a specific feature
image defined or if they share a link to anywhere on podman-desktop.io,
it should provide a general Podman Desktop branded banner.

Signed-off-by: Máirín Duffy <[email protected]>
Helps address issue containers#3613... moving blog images to the static folder to
try to have reliable image links for social card previews. These are
optimized too so they should save space once we remove the old copies.

Signed-off-by: Máirín Duffy <[email protected]>
updating the 5 most recent blog posts (as of 29 aug 2023 😀) with static
images so the social media previews for them will have more stable links
than whatever docusaurus is doing with adding tokens to the image names

Signed-off-by: Máirín Duffy <[email protected]>
@benoitf benoitf force-pushed the blog-social-media-banner-fix branch from ad43eee to dcdf38f Compare August 30, 2023 06:21
@benoitf
Copy link
Collaborator

benoitf commented Aug 30, 2023

@mairin I have rebased your branch using git pull --rebase origin main

Copy link
Collaborator

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

checked and it's working nicely 🎉

we'll have better images when sharing on social media

@benoitf benoitf enabled auto-merge (squash) August 30, 2023 06:26
@benoitf benoitf merged commit 8a3ad5e into containers:main Aug 30, 2023
11 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.4.0 milestone Aug 30, 2023
@mairin mairin deleted the blog-social-media-banner-fix branch August 30, 2023 18:45
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