Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

03 Create New Articles

David Saah edited this page Jul 3, 2023 · 5 revisions

Housekeeping

I assume you've read the Local Development Setup guide and you're ready to go. If not, please read it before proceeding to the next section.

Setup

1. Create a new branch

Create a new branch and switch to it

git branch post-<title>
git checkout post-<title>

2. Create post

hugo create posts/your-article-title/index.md

3. Navigate to post

cd content/posts/your-article-title/

Using any text editor of your choice, you can edit index.md.

Note

  • The title name should be all lowercase, and spaces must be replaced by hyphens.
  • The project has been configured to understand this syntax and the article title will be capitalised automatically in the template content generated in index.md

4. Understanding the index.md template

---
title: "Your Article Title"
date: 2023-07-03T13:42:33Z
draft: true
toc: true
categories:
    - "mentee or client"
summary: Provide content summary.
tags:
    - tag#1
    - tag#2
---

  • title [string]: The article title. (Automatically generated)

  • date [datetime]: Date and time the article was created. (Automatically generated)

    • There is no need to update this value manually. The date value will be updated based on the last git commit for the index.md file.
  • draft [boolean]: Tracks whether the article is a draft or ready to be published.

    • It prevents drafts to be rendered on the blog.
    • Set this value to true when you are done with the article.
  • toc [boolean]: Whether or not to show table of contents.

    • A minimum of 100 words needs to detected to show the table of contents.
    • When set to false, no table of contents is shown.
  • categories [string]: Define the category your blog falls under. E.g. Data structures, file handling, all those good stuff :)

  • summary [string]: Displays a tagline on the cover of the article on the homepage.

Screenshot

image

"Programming languages are tools, not solutions" is the summary.

  • tags [string list]: These are tags for your articles. This could be the programming language that the article talks about or any key concepts the article may address.

There are another data values that is not added to the frontmatter by default.

  • featured_image [url]: A link to an image for your article's cover.

    • For best results, use images with 1260x750 resolution.
    • You can either create a custom image or use less restricted copyright images from sites like pexels.
  • refs [string list]: A list of references used in the article. Give credit to whom credit is due.

    <!-- sample -->
    refs:
      - link: https://www.verywellmind.com/what-is-abstract-reasoning-5181522

5. Content

  • The content is written in markdown.
  • If your text editor supports extensions, install markdownlint for style consistency.

Markdownlint rules: https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md

6. Extra Styling

  • Hugo allows the use of shortcodes when writing markdown files.
  • A shortcode is a simple snippet that Hugo will render using a predefined template.
  • The next section extensively covers the shortcode available for use in this project.

Read Available Shortcodes.