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

Generate social images #1725

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Generate social images #1725

wants to merge 1 commit into from

Conversation

gastaldi
Copy link
Collaborator

@gastaldi gastaldi commented Jun 14, 2023

@gastaldi gastaldi changed the title social images Generate social images Jun 14, 2023
@gastaldi gastaldi force-pushed the social_images branch 4 times, most recently from 02613ce to 112a096 Compare June 14, 2023 22:51
@github-actions
Copy link

github-actions bot commented Jun 14, 2023

😭 Deploy PR Preview failed.

@gastaldi
Copy link
Collaborator Author

Marking as a draft since the images generated in _site/assets/images/social are being deleted during the build

@gastaldi gastaldi marked this pull request as draft June 14, 2023 23:15
@gastaldi gastaldi requested a review from gsmet June 14, 2023 23:29
@maxandersen
Copy link
Member

yeah jekyll needs to know about the images - you can't just dump them into directories that comes from direct copies.

I had this issue in the past - trying to recall what was the fix...

@maxandersen
Copy link
Member

so yeah, now i recall - you need to have it be a full plugin OR commit them to the actual repo.

Did you try see if https://github.com/boyvanamstel/jekyll-gensocial might just work?

@maxandersen
Copy link
Member

actually gen-scoial could be useful for the blog style content. maybe https://github.com/jekyll/jekyll-seo-tag in combination would be good?

for ascidoc might just steal the approach of gen-social to generate into the source dir that could be in a git ignored folder?

@gastaldi
Copy link
Collaborator Author

I've given https://github.com/boyvanamstel/jekyll-gensocial a try and here are my impressions:

Pros

Cons

  • It only works for blog posts (Under _posts)
  • You MUST have an image: attribute in the blog post otherwise nothing happens
  • Files are generated inside assets/images, changing your source tree (that's why the generated images are not deleted during the build)
  • The generated text isn't center-aligned

In case you're curious, I've pushed a working configuration in https://github.com/gastaldi/quarkusio.github.io/tree/jekyll_gensocial

@gsmet
Copy link
Member

gsmet commented Jul 21, 2023

@gastaldi what's the status of this?

@gastaldi
Copy link
Collaborator Author

It works, but the generated files' sizes surpass the maximum allowed upload size in surge.sh

@holly-cummins
Copy link
Contributor

This might help: https://github.com/marketplace/actions/imagemagick-action. I've used ImageMagick in the past to resize images. In that case they were pictures of fish I was batch-processing, but the principle would be similar.

... or we could do the equivalent in code, maybe with this: https://github.com/rmagick/rmagick. That would have the advantage of being the same locally and in GitHub ... and the disadvantage that ImageMagick has some native components, so the install might be a bit fiddly. Or it might not be - I haven't tried it via a gem.

@gastaldi
Copy link
Collaborator Author

@gsmet according to your suggestion, I added a config that skips the social image generation during preview and it seems to work.

@maxandersen
Copy link
Member

boy this is slow locally ...how long does it take you to build?

@gastaldi
Copy link
Collaborator Author

The first build is slow indeed. The subsequent ones are faster

@maxandersen
Copy link
Member

I run this locally and it generates social images but I only see "quarkus_card.png" in og:image of blogs is that expected?

@gastaldi
Copy link
Collaborator Author

gastaldi commented Oct 24, 2023

I run this locally and it generates social images but I only see "quarkus_card.png" in og:image of blogs is that expected?

Yes, because I am only generating social images for guides. See https://github.com/quarkusio/quarkusio.github.io/pull/1725/files#diff-41b71bd8e56b7f1670ccca46cbf0dec0b906a961b0a9c140914425009ecc879aR36 and https://github.com/quarkusio/quarkusio.github.io/pull/1725/files#diff-41b71bd8e56b7f1670ccca46cbf0dec0b906a961b0a9c140914425009ecc879aR11

@maxandersen
Copy link
Member

mkay - but aren't the blog posts the most shared ones for social images?

why only guides?

@gastaldi
Copy link
Collaborator Author

So far I have only shared guides in my chat messaging apps (which is why I made this change). That may work, need to improve the script to read from the blog directory too.

@maxandersen
Copy link
Member

@gastaldi fun - i rarely share guides - its more blog posts :)

@gastaldi gastaldi force-pushed the social_images branch 8 times, most recently from 6d6dc61 to 11e8f9a Compare November 1, 2023 17:38
- Fixes #1723

Allow skipping social image generation

Also generate social image for blog posts
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.

Customize the preview image for guides
4 participants