Getting familiar with Hugo & GitLab
Setting up Hugo locally1
Install Hugo:
brew install hugo
Setting up on GitLab2
Setup SSH key to allow for pushing!
git clone site-blog
Using Hugo to blog3
Creating a post:
cd /site-blog/content/
hugo new /blog/post-title.md
vim /blog/post-title.md
Notes
- Make sure you only use Header 2 (
##
) and on in posts. Header 1 (#
) is reserved for the post title for SEO. Also be sure to include ALT’s with images, and Titles with all links for SEO. - A full markdown cheatcheat can be found HERE.
- In order to create a URL that is truly SEO-friendly, one must take into account certain factors that Google deems important for rankings. Some of these factors include the length of the URL not exceeding 120 characters, how relevant the wording in the title is to the content in the post, avoiding symbols and underscores within the slug, inclusion of session IDs, too many different sub-folders, and so on.
- Avoid overcomplicating your URL structure by only focusing on using keywords in your slug that are relevant to the content in the post. Your URL should only contain numbers, letters, and dashes, and you should avoid using extraneous characters such as:
!, @, #, $, %, ^, &, *, (, ), [, ], ?, {, }, ;, :, “.
Cover Images:
All cover images need to be placed in /site-blog/themes/hello/static/cover/
Reference with image filename (cover = "cover/temp2.png"
) in your post-name.md
header
Post Images:
All post images need to be placed in /site-blog/themes/hello/static/images/
Reference with <img src="/images/image.png" width="" alt="">
Preview posts
To preview your post, run:
hugo server -D -w
Then navigate to localhost:1313
Shut down local server preview with CTRL+C
Push your new post!
git push
© 2024 Payton Schwarz