Although not as sought-after as they once were, RSS feeds can still be a useful addition to any site - if only to allow Google Webmasters to easily crawl it. Luckily, with Hugo this process is very simple as the functionality comes built in and ready to go for when you need it.
Step 1) You’ll need to make sure ‘RSS’ is listed in our outputs within your config.toml file.
1
2
[outputs]home=["HTML","RSS"]
Then, using the base xml template, you should be able to access it at /index.xml - on local this might show as:
1
http://localhost:1313/index.xml
Linking
You can link directly to this page for humans and robots alike, but if you want to list the rss feed for your posts you can add this snippet to the head element of your theme.
1
2
3
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<linkrel="%s"type="%s"href="%s"title="%s"/>` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
Custom RSS
If you want to create your own rss, or add to the default one, it’s no problem. You can create an overriding xml file. This file probably won’t exist initially, so you’ll have to create it.
We’ve attached an example file below (the one we use on this site).
Edd is a PHP and Go developer who enjoys blogging about his experiences, mostly about creating and coding new things he's working on and is a big beliver in open-source and Linux.
Markdown for Hugo: Cheatsheet
–
This is designed to be a ‘cheatsheet’ to help you find the syntax you need quickly for creating markdown content on Hugo sites.
Code Block 1 2 3 4 5 ```css body { background: red; } ``` To define a code block, wrap the code in backticks like: `
Three of them, and you can define the code language after the first set, like we’ve said the above code is css.
Using Emoji In Posts & Themes
–
Emojis have been named word of the year and are seen every day in modern culture. We use them every day on our messaging apps, emails and … err blogs!
This post is about how you can enable and use them in both your Hugo themes and, in general, when writing posts.
Using Emojis in Themes To use them within your theme, there’s a built in function which turns text in emojis.
Migrate Wordpress to Hugo
–
Wordpress is a fantastically popular blogging platform, but judging by the fact you are here, you’re looking to move to Hugo (great choice!)
The software we’ve used in the past to do this for us is called wordpress-to-hugo-exporter (does as it’s name suggests). This will essentially convert the database posts saved into markdown files which you can use in Hugo and with your theme of choice.
View on Github How to It’s important to note this works as a Wordpress plugin, so if you can’t install plugins it may not work for you.