|
| 1 | +--- |
| 2 | +title: "Contributing Manuals and Multi-Part Content" |
| 3 | +format: html |
| 4 | +--- |
| 5 | + |
| 6 | +We welcome contributions of workflow manuals, tool guides, or other multi-part documentation to the EMC Viroscience website! This guide outlines the steps to prepare and submit your content. Our website uses [Quarto](https://quarto.org/), so your contribution should ideally be written using Quarto's features, particularly the Quarto Book format for organization. |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +Before you start, make sure you have the following installed and configured: |
| 11 | + |
| 12 | +1. **Quarto:** Install the latest version from the [Quarto Get Started page](https://quarto.org/docs/get-started/){target="_blank"}. Quarto allows you to create dynamic content with Python, R, Julia, and Observable. |
| 13 | +2. **Git:** Git is essential for version control and contributing to the website repository. Download and install it from [https://git-scm.com/downloads](https://git-scm.com/downloads){target="_blank"}. Familiarize yourself with basic Git commands (`clone`, `add`, `commit`, `push`, `pull`, `branch`). |
| 14 | +3. **IDE (Recommended):** While you can use any text editor, IDEs like [RStudio](https://posit.co/download/rstudio-desktop/){target="_blank"} or [VS Code](https://code.visualstudio.com/){target="_blank"} offer excellent Quarto integration, making writing and previewing easier. This website project itself (`EMC-Viroscience.github.io`) includes an `.Rproj` file for easy opening in RStudio. |
| 15 | +4. **GitHub Account:** You'll need a free GitHub account to contribute. |
| 16 | + |
| 17 | +## Step 1: Write Your Content (Preferably as a Quarto Book) |
| 18 | + |
| 19 | +The easiest way to structure multi-page content like a manual is using the **Quarto Book** format. |
| 20 | + |
| 21 | +1. **Create a New Quarto Book Project:** In your chosen IDE (like RStudio: File > New Project > New Directory > Quarto Book) or via the command line (`quarto create project book my-manual-name`), create a new Quarto Book project *on your own computer*. This keeps your manual organized during development. |
| 22 | +2. **Write Your Chapters:** Create separate `.qmd` files for each chapter or section of your manual within your book project. |
| 23 | +3. **Organize Chapters (Optional but Recommended):** Use the `_quarto.yml` file *within your book project* to define the chapter order. This helps you structure the content logically while writing, even though we'll adapt this for the main website later. |
| 24 | + |
| 25 | +## Step 2: Prepare Your Files for the Website |
| 26 | + |
| 27 | +This is where we adapt your book content for integration into the main EMC Viroscience website structure. |
| 28 | + |
| 29 | +1. **Naming Convention:** Adopt a consistent naming scheme for your `.qmd` files *that will be added to the website*. This helps organize the content and enables automatic sidebar generation. The recommended template is: |
| 30 | + |
| 31 | + `{id}-{number}-main-page-{name}.qmd` (for the *first* chapter/entry page) |
| 32 | + |
| 33 | + `{id}-{number}-{name}.qmd` (for *subsequent* chapters) |
| 34 | + |
| 35 | + * **`{id}`:** A short, unique identifier for *your entire manual* (e.g., `IMAM`, `MyTool`). **Use the same ID for all files belonging to this manual.** |
| 36 | + * **`{number}`:** A two-digit number representing the chapter order (e.g., `01`, `02`, `10`). This ensures correct sorting when listed automatically. |
| 37 | + * **`main-page`:** This keyword **must** be included in the filename of your *first* chapter (the entry point). The website uses this (`posts/*main-page*.qmd`) to identify the primary pages to list on the homepage blog roll. |
| 38 | + * **`{name}`:** A descriptive name for the chapter (e.g., `index`, `preparation`, `usage`). |
| 39 | + |
| 40 | + **Example (from the Illumina Metagenomic Analysis Manual):** |
| 41 | + |
| 42 | + * `IMAM-01-main-page-index.qmd` (Entry page, identified by `main-page`) |
| 43 | + * `IMAM-02-preparation.qmd` |
| 44 | + * `IMAM-03-quality_control.qmd` |
| 45 | + * ...etc. |
| 46 | + |
| 47 | +2. **Rename Your Book's `index.qmd`:** Since the website uses a specific pattern for main entry pages, rename your book's original `index.qmd` file according to the naming convention above, making sure it includes `-main-page-`. |
| 48 | + |
| 49 | +## Step 3: Contribute to the Website Repository |
| 50 | + |
| 51 | +We use the standard GitHub Fork & Pull Request workflow for contributions. |
| 52 | + |
| 53 | +1. **Fork the Repository:** Go to the main website repository: [https://github.com/EMC-Viroscience/EMC-Viroscience.github.io](https://github.com/EMC-Viroscience/EMC-Viroscience.github.io) and click the "Fork" button in the top-right corner. This creates a copy of the repository under your own GitHub account. |
| 54 | +2. **Clone Your Fork:** Clone the forked repository to your local machine: |
| 55 | + ```bash |
| 56 | + git clone https://github.com/YOUR-GITHUB-USERNAME/EMC-Viroscience.github.io.git |
| 57 | + |
| 58 | + cd EMC-Viroscience.github.io |
| 59 | + ``` |
| 60 | +3. **Create a New Branch:** Create a descriptive branch for your changes: |
| 61 | + |
| 62 | + ```bash |
| 63 | + git checkout -b add-manual-yourid # e.g., add-manual-imam |
| 64 | + ``` |
| 65 | + |
| 66 | +## Step 4: Integrate Your Files into the Website |
| 67 | + |
| 68 | +Now, add your prepared content and configure the website. |
| 69 | + |
| 70 | +1. **Copy `.qmd` Files:** Copy all your renamed `.qmd` files (from Step 2) into the `posts/` directory within the cloned website repository. |
| 71 | +2. **Configure `_quarto.yml`:** Open the `_quarto.yml` file in the root of the website repository. Add a new sidebar definition specific to your manual. Find the `sidebar:` section and add an entry like this: |
| 72 | + |
| 73 | + ```yaml |
| 74 | + # _quarto.yml |
| 75 | +
|
| 76 | + # ... (other website config) ... |
| 77 | +
|
| 78 | + sidebar: # Define a list of sidebar configurations |
| 79 | + - id: id-blogs # Existing sidebar for general posts |
| 80 | + title: "Blog Posts" |
| 81 | + style: "docked" |
| 82 | + contents: |
| 83 | + - auto: posts/*main-page*.qmd |
| 84 | +
|
| 85 | + - id: id-yourid # Add your new sidebar definition HERE |
| 86 | + title: "Your Manual Title" # The title displayed above the sidebar |
| 87 | + style: "docked" |
| 88 | + contents: |
| 89 | + - auto: posts/yourid*.qmd # Use your unique ID prefix |
| 90 | +
|
| 91 | + # ... (rest of the config like format:) ... |
| 92 | + ``` |
| 93 | + * Replace `id-yourid` with a unique ID for your sidebar (e.g., `id-imam`, `id-mytool`). **This ID must be unique within the file.** |
| 94 | + * Replace `"Your Manual Title"` with the full title you want displayed. |
| 95 | + * Replace `yourid*.qmd` with the pattern matching your files (using the unique ID you chose, e.g., `IMAM*.qmd`). |
| 96 | + |
| 97 | +3. **Configure Frontmatter:** Open your *main entry page* `.qmd` file (the one with `-main-page-` in the name, e.g., `IMAM-01-main-page-index.qmd`) located in the `posts/` directory. Add or modify its YAML frontmatter at the top: |
| 98 | + |
| 99 | + ```yaml |
| 100 | + --- |
| 101 | + title: "Full Title of Your Manual" |
| 102 | + author: "Your Name(s)" |
| 103 | + date: "YYYY-MM-DD" # Or use "today" |
| 104 | + # description: "A brief description for the listing page." # Optional |
| 105 | + # image: "path/to/optional_image.png" # Optional |
| 106 | + # Add any custom fields like Reading Time if used by the listing |
| 107 | + sidebar: id-yourid # IMPORTANT: Use the *exact* sidebar ID you defined in _quarto.yml |
| 108 | + --- |
| 109 | +
|
| 110 | + # Start the content of your first chapter/introduction here... |
| 111 | + This is the main page for the manual... |
| 112 | + ``` |
| 113 | + * Fill in the `title`, `author`, `date`, etc. |
| 114 | + * **Crucially**, set the `sidebar:` value to the *exact `id`* you created in `_quarto.yml` (e.g., `sidebar: id-imam`). This tells Quarto to display the specific sidebar containing your manual's chapters when viewing this page and subsequent pages linked from it (if they don't specify their own sidebar). |
| 115 | + |
| 116 | +## Step 5: Test Locally |
| 117 | + |
| 118 | +Before submitting, preview your changes: |
| 119 | + |
| 120 | +1. Open a terminal within the website repository directory (`EMC-Viroscience.github.io`). |
| 121 | +2. Run `quarto render`. Check for any errors. |
| 122 | +3. Run `quarto preview`. This should open the website in your browser. |
| 123 | +4. Navigate to the homepage. Does your manual's main page appear correctly in the listing? |
| 124 | +5. Click on your manual's entry. Does it load the correct page? |
| 125 | +6. Check the sidebar. Does it show the correct title and list your chapters in the intended order (based on the `01`, `02` numbering)? |
| 126 | +7. Click through your chapters in the sidebar. Do they navigate correctly? |
| 127 | + |
| 128 | +## Step 6: Submit Your Contribution |
| 129 | + |
| 130 | +Once you're happy with the local preview: |
| 131 | +
|
| 132 | +1. **Stage and Commit:** Add your changes using Git: |
| 133 | +
|
| 134 | + ```bash |
| 135 | + git add posts/yourid*.qmd # Add your new content files |
| 136 | + git add _quarto.yml # Add the modified config file |
| 137 | + git commit -m "Add manual: Your Manual Title" # Descriptive commit message |
| 138 | + ``` |
| 139 | +2. **Push to Your Fork:** Push your new branch to your forked repository on GitHub: |
| 140 | +
|
| 141 | + ```bash |
| 142 | + git push -u origin add-manual-yourid # Push the branch you created |
| 143 | + ``` |
| 144 | +3. **Create a Pull Request (PR):** Go to your forked repository on the GitHub website. You should see a prompt to "Compare & pull request". Click it. |
| 145 | + * Ensure the base repository is `EMC-Viroscience/EMC-Viroscience.github.io` and the base branch is `main` (or the default branch). |
| 146 | + * Ensure the head repository is your fork and the compare branch is `add-manual-yourid`. |
| 147 | + * Write a clear title and description for your PR, explaining the manual you've added. If it relates to a specific issue, link the issue number. |
| 148 | + * Click "Create pull request". |
| 149 | + |
| 150 | +## Next Steps |
| 151 | + |
| 152 | +The maintainers of the EMC Viroscience website will review your pull request. They may ask for changes or clarifications. Once approved, your contribution will be merged, and your manual will appear on the live website! |
| 153 | + |
| 154 | +Thank you for contributing! If you have questions during this process, please feel free to open an issue on the [website repository's issue tracker](https://github.com/EMC-Viroscience/EMC-Viroscience.github.io/issues). |
0 commit comments