Have you ever wanted to embed a code snippet in your blog?
Yes, we have the <code> tag within the WordPress visual editor but if you notice a lot of the bloggers, developers use Github gist to do that.
Related: How to embed YouTube videos ( opens in a new tab )
Here’s a sample from Brian Gardner from StudioPress/Copyblogger using the Github gist:
It’s quite simple.
- Just go to https://gist.github.com
- Input the code and click on ‘create secret gist‘ – this way search engines wouldn’t index your code and only people with the URL will have access to it.
- Share using the ‘Embed’ code option – copy the embed code and paste it within your WordPress code editor (the Text tab, not the Visual tab).
- You can also download this code sample as a zip file.
Below given are some screenshots for your reference.
Next time you want to share your code on your blog, try the Github Gist.
Leave a Reply