|
| 1 | +--- |
| 2 | +title: "How to Contribute" |
| 3 | +date: 2019-09-01T21:37:03-04:00 |
| 4 | +draft: true |
| 5 | +description: "See how you can contribute to the matplotblog." |
| 6 | +categories: ["tutorials"] |
| 7 | +displayInList: true |
| 8 | +draft: false |
| 9 | +author: Davide Valeriani |
| 10 | +resources: |
| 11 | +- name: featuredImage |
| 12 | + src: "contribute.jpg" |
| 13 | +--- |
| 14 | + |
| 15 | +Matplotblog relies on your contributions to it. We want to showcase all the amazing projects that make use of Matplotlib. In this post, we will see which steps you have to follow to add a post to our blog. |
| 16 | + |
| 17 | +To manage your contributions, we will use [Git pull requests](https://yangsu.github.io/pull-request-tutorial/). So, if you have not done it already, you first need to clone [our Git repository](https://github.com/matplotlib/matplotblog), by typing the following in a terminal window: |
| 18 | +``` |
| 19 | +git clone https://github.com/matplotlib/matplotblog.git |
| 20 | +``` |
| 21 | + |
| 22 | +Then, you should create a new branch, which will contain your changes. |
| 23 | + |
| 24 | +``` |
| 25 | +cd matplotblog |
| 26 | +git checkout -b post-my-fancy-title |
| 27 | +``` |
| 28 | +The name of your branch should begin with *post-* followed by the short title of your blog post. |
| 29 | + |
| 30 | +Then you should create a new blog post. We have used [Hugo](https://gohugo.io/) to create the Matplotblog, so you will first need to [install it](https://gohugo.io/getting-started/quick-start/#step-1-install-hugo). To create a new post, decide a title (e.g., *my-fancy-title*) and type the following: |
| 31 | +``` |
| 32 | +hugo new posts/my-fancy-title/index.md |
| 33 | +``` |
| 34 | + |
| 35 | +This command will create a new folder under *folder_repository/posts/* called *my-fancy-title*. This will be your working directory for the post. If you want to add external content to your post (e.g., images), you will add it to this folder. |
| 36 | + |
| 37 | +You can now open the file *index.md* in your post folder with your favorite text editor. You will see a header section delimited by ---. Let us go through all the headings you can configure: |
| 38 | +``` |
| 39 | +title: "Your fancy title" |
| 40 | +``` |
| 41 | +This is the title of your post that will appear at the beginning of the page. Pick a catchy one. |
| 42 | +``` |
| 43 | +date: 2019-09-01T21:37:03-04:00 |
| 44 | +``` |
| 45 | +The current date and time, you do not need to modify this. |
| 46 | +``` |
| 47 | +draft: false |
| 48 | +``` |
| 49 | +Specify that the post is not a draft and you want it to be published right away. |
| 50 | +``` |
| 51 | +description: "This is my first post contribution." |
| 52 | +``` |
| 53 | +This is a long description of the topic of your post. Modify it according to the content. |
| 54 | +``` |
| 55 | +categories: ["tutorials"] |
| 56 | +``` |
| 57 | +Pick the category you want your post to be added to. You can find the list of categories in the top right menu of matplotblog (except for Home and About). |
| 58 | +``` |
| 59 | +displayInList: true |
| 60 | +``` |
| 61 | +Specify that you want your post to appear in the list of latest posts and in the list of posts of the specified category. |
| 62 | +``` |
| 63 | +author: Davide Valeriani |
| 64 | +``` |
| 65 | +Add your name as author. Multiple authors are also possible, separate them by commas. |
| 66 | +``` |
| 67 | +resources: |
| 68 | +- name: featuredImage |
| 69 | + src: "my-image.jpg" |
| 70 | +``` |
| 71 | +Select an image to be associated to your post, which will appear aside the title in the homepage. Make sure to add *my-image.jpg* to your post folder. |
| 72 | + |
| 73 | +Now, you can write the main text of your post. We fully support [markdown](https://markdown-guide.readthedocs.io/en/latest/basics.html), so use it to format your post. |
| 74 | + |
| 75 | +To preview your new post, open a terminal and type: |
| 76 | +``` |
| 77 | +hugo server |
| 78 | +``` |
| 79 | +Then open the browser and visit [http://localhost:1313/matplotblog](http://localhost:1313/matplotblog) to make sure your post appears in the homepage. If you spot errors or something that you want to tune, go back to your index.md file and modify it. |
| 80 | + |
| 81 | +When your post is ready to go, you can commit and push the changes to your branch: |
| 82 | +``` |
| 83 | +git commit -am "Added new blog post" |
| 84 | +git push |
| 85 | +``` |
| 86 | + |
| 87 | +Finally, submit a pull request to have our admins review your contribution and merge it to the master repository. That is it folks! |
0 commit comments