Adding images to your GitHub Pages site

The Jekyll publishing system used by GitHub Pages expects you to have an assets directory, and that’s where image files should be placed. By convention they go into an images subdirectory (full path /docs/assets/images but that’s not a firm requirement. They can be anywhere in the /docs/assets path.

Create a directory called /docs/assets

Upload images to the /docs/assets directory

  • On GitHub, navigate to the /docs/assets directory.

  • Click the Add file button, then choose Upload files

Screenshot of uploading a file to the /docs/assets directory

  • Upload one or more files, then choose Commit changes at the bottom of the page.

Screenshot showing the commit changes button

Add proper Markdown to display the image

Now insert Markdown text to specify an image. It’s the same as for a link, but preceded by a ! character. For example, if you want to show a file named logo.png in the assets directory (really /docs/assets in this example), you’d employ this Markdown. Note that the text in between the [ and ] should be a clear description of the image. It’s used by screen readers for visually impaired users.

![Book logo](/least-github-pages/assets/logo.png)

Book logo

Previous page Next page

Home