Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize preview image for github pages

is it possible to customize the image that you see as a preview when posting the link to your github pages?

I feel like they specifically address the issue for github repositories here, but I dont know how to do this for github pages. Specifically, I want my github page to not just display just a grey image of nothing, when it is showing up on my Featured section on LinkedIn:

enter image description here

like image 576
Paul Schmidt Avatar asked Jul 05 '20 16:07

Paul Schmidt


People also ask

How do I add an icon to a GitHub repository?

Go to your project then in left side click on 'Setting' Click on 'General' then in 'General project' section hit Expand. Then in project avatar section hit Choose file... your avatar icon file and upload it.

How do I change the view in GitHub?

Changing the project layout You can view your project as a table or as a board. Click next to the name of the currently open view. Under "Layout", click either Table or Board.

Can I upload images to GitHub Pages?

Upload images to GitHub. Create a new issue on GitHub. Drag-and-drop an image onto the comment field. Wait for the upload process to finish.


1 Answers

This preview image taking from website meta tags. Specifically for LinkedIn enough to use:

<meta property="og:image" content="preview_image.jpg" />

Example from my LinkedIn: enter image description here

The first two featured items are my personal website pages, and each of them has separate meta tags. It hosted on GitHub Pages, but it doesn't matter where to host. Here is how it's can be done:

<head>
      {/* all socials */}
      <meta property="og:image" content={previewImageSrc} />
      {/* twitter */}
      <meta name="twitter:image" content={previewImageSrc} />
</head>

full example (gatsby + react-helmet)

like image 169
Alexandr Tovmach Avatar answered Oct 07 '22 00:10

Alexandr Tovmach