A Gist is a Git repository which can be automatically versioned, forked and cloned. Thanks to its characteristics, it is simple to use Gist to share files, either parts of it or the full version to other people. There are two types of Gists that are available,
Public gist and
Secret gist. As their names suggest, you can use
Public gist when you want others to find and know your work or in other words, the
Public gist can be searched via the search bar. These gists also appear on the
Discover of Github where new gists can be found after creation. There is a note that once you complete the creating process of a gist, you cannot change its type, from public to secret.
On the other hands,
Secret gist cannot be look up with the searching tool and show up on the
Discover. You can use this to store a new idea just comes across your mind, a wish-list or something you do not want to publish yet. However, you can still share the
Secret gist with your friend if you want by sending them the URL of your gist. A stranger can also see your gists if they know the URL in some ways. You can refer to the picture below for the example of a gist. It is possible to add a Gist on your WordPress site to share files with your visitors if you want that you can check out more in the next part of this post.
Table of content
Using a URL
Open your gist on Github and copy the link on the address bar. After that, open the
Visual editor on your WordPress site and paste it on a line by itself. This is the simplest way because all you have to do is copy and paste, however, you must ensure that the link is not hyperlink by pressing on it. If you do that and the hyperlink button is highlighted and a link box with edit option appear on your screen, it means your link is a hyperlink.
Using a shortcode
If you want to try another way, you can use the shortcode also. At first, you need to copy the URL of the gist as shown in the previous part. Next, you have to generate a shortcode as follows but with the link of your gist:
You can create a shortcode with the ID of the gist only. The ID is the series of the number next to the github.com section on the link:
To conclude, this topic is about the process of embedding a Gist on your store on WordPress. You can complete it with two different approaches and it is recommended to use the first one because it is easier to practice. Images are also included in this writing to help you understand more about the gist and how to insert it to your website. Hence, hope that you find this post interesting and helpful to you or at least you have a good reading experience.