Contributing to an open source web site
Overview
- Duration: 30 minutes, with 15-minute post discussion
- Goals
- Able to clone any open-source repository from GitHub locally and run it using Hugo!
- Make changes to such repository by following the Git workflow and creating a pull request!
- Optional activity
Tasks
This week, we used Git, which really becomes powerful when collaborating with others - sometimes even with people you’ve never met before! In fact, you can easily contribute to open source projects, simply by “forking” a public GitHub repository (= taking a copy of the repository), making changes to the source code, and proposing to the owner of the project to integrate your changes in the “head revision”/“main branch” (= the code that runs the project).
Now, start putting your Git skills into practice, by making changes to the course website, or Tilburg Science Hub. For example, by fixing typos, or rewriting parts of the tutorials or building blocks. To get started, view the steps below.
How to contribute to an open source project
The instructions below pertain to this course website and Tilburg Science Hub, both of which are websites run with the Hugo framework.
Step 1: Get to know the repository
- Familiarize yourself with the repository top which you want to contribute. Typically, each repository has a readme with general instructions on what the repository is about (& how to run the code). Also, new features and bugs are discussed at the repository’s issue page. Finally, many repositories contain a discussion forum and project board in which you can learn about the roadmap of the project.
- Visit the course repository, or Tilburg Science Hub.
- Browse through the repository’s readme (that’s what you see when you click on the links above), issue page, and project/discussion boards.
Step 2: Run the repository’s code (= run the website)
- Install hugo - that’s the content management system we use for running these websites (Note: it may be required to install the extended version to run this course repository!).
- Fork one of the repositories (click on the fork button in the upper right corner on Git). This creates a copy of the code in your GitHub account.
- Clone your own fork to the disk, e.g.,
git clone https://github.com/your-user-name/course-dprep
.- Enter the directory of the cloned repository using
cd course-dprep
, and runhugo server
.- You can now open the website locally in your browser. Check the terminal for the exact address, but likely you just have to enter
https://127.0.0.1:1313
in your browser!- Check out the code in
\docs
- the websites are written in Markdown, and you can easily add/change. Observe how the site actually changes in your browser!- Open the course in a text editor such as Visual Studio and put it side-to-side with the local Hugo server. You will see that any changes you make and save in Visual Studio are visible on the server!
Step 3: Make changes
- Find stuff that you want to add or fix.
- Create a new branch (
git branch name-of-a-new-feature
) (e.g., call itfix-typo-tutorial
, orbuildingblock-new
).- Work on your new feature. Throughout, apply the Git workflow (
git status
,git add
,git commit -m "commit message"
)- When you’re done with all of your changes, push your changes to your GitHub repository
git push -u origin name-of-a-new-feature
- Fully done & happy? Issue a pull request from the website. Write a little description for what you did when sending your PR.
Build your CV
Many data science and marketing analytics students put their GitHub profiles and contributions on their CV. For example, check the website of Roy Klaasse Bos, and his GitHub profile.