|
| 1 | +# Contributing Guide for Open Science Labs Blog |
| 2 | + |
| 3 | +## Getting Started |
| 4 | + |
| 5 | +To contribute to the Open Science Labs blog, you should first fork the |
| 6 | +repository and clone it locally. Follow these steps to set up your local |
| 7 | +development environment: |
| 8 | + |
| 9 | +```bash |
| 10 | +# Clone your fork of the repository |
| 11 | +$ git clone https://github.com/MY-USER-NAME/opensciencelabs.github.io |
| 12 | +$ cd opensciencelabs.github.io |
| 13 | + |
| 14 | +# Add the original project as an upstream remote |
| 15 | +$ git remote add upstream https://github.com/opensciencelabs/opensciencelabs.github.io |
| 16 | +$ git fetch --all |
| 17 | +``` |
| 18 | + |
| 19 | +_Note: Replace `MY-USER-NAME` with your GitHub username._ |
| 20 | + |
| 21 | +## Setting Up the Environment |
| 22 | + |
| 23 | +Set up the Conda environment to manage the dependencies for the blog: |
| 24 | + |
| 25 | +```bash |
| 26 | +# Create and activate the Conda environment |
| 27 | +$ mamba env create --file conda/dev.yaml |
| 28 | +$ conda activate osl-web |
| 29 | +``` |
| 30 | + |
| 31 | +This will create a new Conda environment named `osl-web` with all necessary |
| 32 | +dependencies and activate it. |
| 33 | + |
| 34 | +## Developing Blog Posts |
| 35 | + |
| 36 | +### Development Commands |
| 37 | + |
| 38 | +- **Previewing Changes:** Use `makim pages.preview` to run a local server for |
| 39 | + previewing the blog and other pages. |
| 40 | +- **Building the Site:** Before pushing changes to GitHub, build the site using |
| 41 | + `makim pages.build` to ensure everything is compiled correctly. |
| 42 | + |
| 43 | +### Creating a New Blog Post |
| 44 | + |
| 45 | +1. **Prepare the Blog Post:** |
| 46 | + |
| 47 | + - Navigate to `pages/blog` and create a new folder with a slugified version |
| 48 | + of your blog post's title. Use |
| 49 | + [https://slugify.online/](https://slugify.online/) to generate a slug. |
| 50 | + - Inside this folder, create your blog post file: |
| 51 | + - For Markdown: `index.md` |
| 52 | + - For Jupyter Notebooks: `index.ipynb` (use Jupyter Lab to create this |
| 53 | + directly) |
| 54 | + |
| 55 | +2. **Include a Header Image:** |
| 56 | + - Place a header image (either `header.png` or `header.jpg`) in your blog |
| 57 | + post folder. Make sure the image is under a free license. |
| 58 | + |
| 59 | +### Metadata and Formatting |
| 60 | + |
| 61 | +- **Markdown Posts:** Add a metadata block at the beginning of your `index.md` |
| 62 | + file: |
| 63 | + |
| 64 | + ```markdown |
| 65 | + --- |
| 66 | + title: "Title of Your Blog Post" |
| 67 | + slug: "slug-of-your-blog-post" |
| 68 | + date: YYYY-MM-DD |
| 69 | + authors: ["Author Name"] |
| 70 | + tags: ["tag1", "tag2"] |
| 71 | + categories: ["category1", "category2"] |
| 72 | + description: "Short description of the blog post." |
| 73 | + thumbnail: "/header.jpg" |
| 74 | + template: "blog-post.html" |
| 75 | + --- |
| 76 | + ``` |
| 77 | + |
| 78 | +- **Jupyter Notebook Posts:** The first cell of your `index.ipynb` should be in |
| 79 | + `raw` mode containing the same metadata as above. |
| 80 | + |
| 81 | +3. **Building and Viewing:** |
| 82 | + - If using a Jupyter Notebook, run `makim pages.build` to convert the |
| 83 | + notebook into a Markdown file (`index.md`). |
| 84 | + - Add the generated `index.md` to your repository as it will be used to |
| 85 | + render the webpage. |
| 86 | + |
| 87 | +## Final Steps |
| 88 | + |
| 89 | +Before submitting your blog post: |
| 90 | + |
| 91 | +- Ensure all files are added to your repository. |
| 92 | +- Submit a pull request to the main `opensciencelabs.github.io` repository for |
| 93 | + review. |
| 94 | + |
| 95 | +Thank you for contributing to the Open Science Labs blog! |
0 commit comments