HomeThe ClassicsFarai's Codelab

Hey Look, I Made My First Open Source Contribution!

Published: Updated:

I was re-redesigning my Hugo website and I was looking into how page resources. There I noticed a typo under Pattern Matching which made the code both unreliable and unreadable.

// Using Match/GetMatch to find this images/sunset.jpg ?
.Resources.Match "images/sun*" 
.Resources.Match "**/Sunset.jpg" 
.Resources.Match "images/*.jpg" 
.Resources.Match "**.jpg" 
.Resources.Match "*" 🚫
.Resources.Match "sunset.jpg" 🚫
.Resources.Match "*sunset.jpg" 🚫

With the jaring capitalization of sunset.jpg, this example becomes false as line 70 with the case "**/Sunset.jpg" ✅ isn’t so ✅. This grave oversight made me make my first ever open source contribution. Scrolling to the bottom of the page, I found a blue button titled IMPROVE THIS PAGE which let me edit the page on GitHub. With all my brain power, I had to find this bug and fixed it.

- .Resources.Match "**/Sunset.jpg" ✅
+ .Resources.Match "**/sunset.jpg" ✅

Once I forked the repo and filed a pull request, it was time for the long wait for a response. With such a serious commit, I expected this to take days to review. Around an hour later I got an email saying that my pull request has been merged, making me an official contributor to Hugo’s Documentation. It’s been such a great achievement and it marks the first of (hopefully) many open source contributions.

At the time of writing this, the bottom of the Page Resource’s page goes to my pull request. I’ve never been so proud of myself.

Text saying ‘Page Resources’ was last updated: January 15, 2020: Fixed typo in content-management/page-resources (127a32f9) followed by a button saying `IMPROVE THIS PAGE’

The GitHub Page for my pull request

Similar Commits

While I only changed a letter, I’m sure than many such small contributions will ultimatley improve documentation over time. This reminds me of the time when a four year old, Masia Roponen committed to the Linux Kernel’s Documentation.

Documentation: fix formatting to make ’s’ happy

“That letter [the last s] is sad because all the others have those things [=][sic] below them and it does not.”

This patch fixes the tragedy so all the letters can be happy again.

The sad s without a = (well -) thing? A heading.

1.9 Ext4 file system parameters
------------------------------
                              ^
                              |
         The 's' has no '-'---| 

It really was sad. Thankfully she fixed it with an extra -, making ’s’ happy.

  1.9 Ext4 file system parameters
- ------------------------------
+ -------------------------------

Again, seems trivial but many such commits can improve a code base’s quality over time. So if you’re scared of contributing to open source, don’t be. Submit that trivial patch (following the project’s contribution guidelines).

What’s Next For My Open Source Journey

Since then I’ve committed to Wes Bos’s /uses project to add my /uses page to it. It was initially rejected because I couldn’t use the 🤷🏾‍♂️ emoji because it was black. Had to settle for 🤷‍♂️ instead.

Here’s the code.

{
  name: "Farai Gandiya",
  description: "Software Developer",
  url: "https://farai.xyz/uses",
  twitter: "@faraixyz",
  emoji: "🤷",
  country: "🇿🇼",
  computer: "windows",
  phone: "iphone",
  tags: ['Developer', 'Web', 'Python']
},

and this is what it looks like live.

My entry on uses.tech with my name, a link to my uses page farai.xyz/uses, my title as Software Developer tags of developer, web and python. Also has the Zimbabwe flag, windows logo, an iPhone and my twitter handle @faraixyz.

If I’m honest, I would ove to say that I’ll contribute a lot more to open source in the coming months, but I recently realized that I can’t say yes to too many things. In light of that, I’ll focus on making my own projects, only committing to open source if I find an error like the typo I fixed. With my projects completed and settling down in life, I hope I’ll be able to commit (hehe) more of my time to open source.