|
| 1 | +# Contribute to the Polkadot Docs |
| 2 | + |
| 3 | +> **📋 Essential**: All contributions must follow the [PaperMoon Style Guide](https://github.com/papermoonio/documentation-style-guide). |
| 4 | +
|
| 5 | +## Contents |
| 6 | +- [Quick Start](#quick-start) |
| 7 | +- [Fix or Improve Existing Content](#fix-or-improve-existing-content) |
| 8 | +- [Add a New Page](#add-a-new-page) |
| 9 | +- [Create a New Section](#create-a-new-section) |
| 10 | +- [Write a Tutorial](#write-a-tutorial) |
| 11 | +- [Working with Content Elements](#working-with-content-elements) |
| 12 | + - [Adding Images](#adding-images) |
| 13 | + - [Using Code Snippets](#using-code-snippets) |
| 14 | + - [Adding Callout Boxes](#adding-callout-boxes) |
| 15 | + |
| 16 | +## Quick Start |
| 17 | + |
| 18 | +1. **Fork and Create Branch** |
| 19 | + ```bash |
| 20 | + git clone https://github.com/your-username/polkadot-docs.git |
| 21 | + cd polkadot-docs |
| 22 | + git checkout -b your-feature-branch |
| 23 | + ``` |
| 24 | + |
| 25 | +2. **Make Your Changes** |
| 26 | + - Follow the [PaperMoon Style Guide](https://github.com/papermoonio/documentation-style-guide) |
| 27 | + - Test your changes locally (see [Running Polkadot Docs Locally](../README.md#run-polkadot-docs-locally)) |
| 28 | + |
| 29 | +3. **Update AI Documentation** |
| 30 | + After making content changes, regenerate the AI-ready documentation files: |
| 31 | + ```bash |
| 32 | + python3 scripts/generate_llms.py |
| 33 | + ``` |
| 34 | + **Note**: Run this script on every PR once all changes are committed. |
| 35 | + |
| 36 | +4. **Create Pull Request** |
| 37 | + - Push your branch and create a pull request |
| 38 | + - Use the PR template to indicate your review preference |
| 39 | + |
| 40 | +## Fix or Improve Existing Content |
| 41 | + |
| 42 | +Making changes to existing pages is the simplest contribution: |
| 43 | + |
| 44 | +1. **Edit the content** - Make your improvements directly to the existing markdown file |
| 45 | +2. **Follow page requirements** - Ensure your changes maintain proper formatting |
| 46 | +3. **Test locally** - Verify your changes render correctly |
| 47 | + |
| 48 | +**No additional files need updating** when you're only modifying existing content. |
| 49 | + |
| 50 | +## Add a New Page |
| 51 | + |
| 52 | +**Requirement**: Follow the [PaperMoon Documentation Style Guide](https://github.com/papermoonio/documentation-style-guide). |
| 53 | + |
| 54 | +To add a page to an existing section: |
| 55 | + |
| 56 | +1. **Create your markdown file** following [naming conventions](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md#naming-conventions) |
| 57 | + |
| 58 | +2. **Include required frontmatter**: |
| 59 | + ```markdown |
| 60 | + --- |
| 61 | + title: Page Title (max 60 chars for SEO) |
| 62 | + description: Description for SEO (120-160 chars) |
| 63 | + --- |
| 64 | + |
| 65 | + # Page Title |
| 66 | + |
| 67 | + ## Introduction |
| 68 | + Write 2-3 paragraphs to introduce the topic. |
| 69 | + |
| 70 | + ## Prerequisites |
| 71 | + List any required tools, knowledge, or setup. |
| 72 | + ``` |
| 73 | + |
| 74 | + Resources for good SEO: |
| 75 | + - [Google's title recommendations](https://developers.google.com/search/docs/advanced/appearance/title-link?hl=en) |
| 76 | + - [Google's description recommendations](https://developers.google.com/search/docs/advanced/appearance/snippet?hl=en) |
| 77 | + |
| 78 | +3. **Update navigation** - Add your page to the `.nav.yml` file in the same directory: |
| 79 | + ```yaml |
| 80 | + - 'Your Page Display Name': 'your-file-name.md' |
| 81 | + ``` |
| 82 | +
|
| 83 | +## Create a New Section |
| 84 | +
|
| 85 | +To create an entirely new section of documentation: |
| 86 | +
|
| 87 | +1. **Create directory structure**: |
| 88 | + ``` |
| 89 | + your-new-section/ |
| 90 | + ├── .nav.yml |
| 91 | + ├── index.md |
| 92 | + └── your-first-page.md |
| 93 | + ``` |
| 94 | + |
| 95 | +2. **Create `.nav.yml`**: |
| 96 | + ```yaml |
| 97 | + title: Section Display Name |
| 98 | + nav: |
| 99 | + - index.md |
| 100 | + - 'Page Display Name': 'file-name.md' |
| 101 | + - subdirectory-name |
| 102 | + ``` |
| 103 | + |
| 104 | + - `title`: Displayed in left navigation |
| 105 | + - `index.md`: Always first in nav list |
| 106 | + - Files: `'Display Name': 'file-name.md'` |
| 107 | + - Subdirectories: Listed by directory name |
| 108 | + |
| 109 | +3. **Create `index.md`** - Landing page with frontmatter and content introducing the section |
| 110 | + |
| 111 | +## Write a Tutorial |
| 112 | + |
| 113 | +This section covers tutorial-specific requirements and formatting. |
| 114 | + |
| 115 | +**Requirement**: Follow the [PaperMoon Documentation Style Guide](https://github.com/papermoonio/documentation-style-guide). |
| 116 | + |
| 117 | +### Choose Your Tutorial Section |
| 118 | +``` |
| 119 | +tutorials/ |
| 120 | +├── dapps/ # Application development guides |
| 121 | +├── interoperability/ # XCM, cross-chain operations |
| 122 | +├── onchain-governance/ # Governance operations |
| 123 | +├── polkadot-sdk/ # SDK-based development |
| 124 | +└── smart-contracts/ # Smart contract development |
| 125 | +``` |
| 126 | +
|
| 127 | +### Set Up Directory Structure |
| 128 | +``` |
| 129 | +tutorials/[section]/[subsection]/[tutorial-name].md |
| 130 | +images/tutorials/[section]/[subsection]/[tutorial-name]/ |
| 131 | +.snippets/code/tutorials/[section]/[subsection]/[tutorial-name]/ |
| 132 | +``` |
| 133 | +
|
| 134 | +### Use the Tutorial Template |
| 135 | +```markdown |
| 136 | +--- |
| 137 | +title: Tutorial Title (max 60 chars) |
| 138 | +description: Description 120-160 chars |
| 139 | +tutorial_badge: Beginner | Intermediate | Advanced |
| 140 | +categories: Category1, Category2 |
| 141 | +--- |
| 142 | +
|
| 143 | +# Tutorial Title |
| 144 | +
|
| 145 | +## Introduction |
| 146 | +Brief explanation of what users will learn/build |
| 147 | +
|
| 148 | +## Prerequisites |
| 149 | +Required knowledge/tools |
| 150 | +
|
| 151 | +## [Action-Oriented Section Title] |
| 152 | +Instructions with commands |
| 153 | +
|
| 154 | +## Verification |
| 155 | +How to confirm it worked |
| 156 | +
|
| 157 | +## Where to Go Next |
| 158 | +Related tutorials |
| 159 | +``` |
| 160 | + |
| 161 | +### Tutorial Requirements |
| 162 | +- All code examples must be tested and functional |
| 163 | +- Always specify dependency versions (e.g., `npm install [email protected]`) |
| 164 | +- Use action-oriented section titles |
| 165 | +- Include verification steps |
| 166 | + |
| 167 | +## Working with Content Elements |
| 168 | + |
| 169 | +### Adding Images |
| 170 | + |
| 171 | +**Where to store**: `images/<path-matching-doc-structure>/` |
| 172 | + |
| 173 | +**Requirements**: |
| 174 | +- Format: `.webp` |
| 175 | +- Desktop screenshots: 1512px width, variable height |
| 176 | +- Browser extension screenshots: 400x600px |
| 177 | + |
| 178 | +**How to use**: |
| 179 | +```markdown |
| 180 | + |
| 181 | +``` |
| 182 | + |
| 183 | +**Adding annotations**: |
| 184 | +Use assets from [.assets/annotations](.assets/annotations/) directory: |
| 185 | +- **Arrows**: Highlight single elements |
| 186 | +- **Steps**: Highlight multiple elements (use numbers for numbered lists, letters for alphabetical lists) |
| 187 | + |
| 188 | +### Using Code Snippets |
| 189 | + |
| 190 | +**Purpose**: For any code used on the page or for reuse of text across multiple pages while maintaining it in one place |
| 191 | + |
| 192 | +**Where to store**: `.snippets/code/<path-matching-doc-structure>/<snippet-name>` |
| 193 | + |
| 194 | +**How to use**: |
| 195 | +```javascript |
| 196 | +--8<-- 'code/<subdirectory>/<snippet-file-name>.js:10:20' |
| 197 | +``` |
| 198 | + |
| 199 | +**File types**: |
| 200 | +- **Text snippets**: `.md` files for reusable copy |
| 201 | +- **Code snippets**: Use appropriate language extension (`.js`, `.py`, etc.) |
| 202 | + |
| 203 | +Learn more about [snippets syntax](https://facelessuser.github.io/pymdown-extensions/extensions/snippets/). |
| 204 | + |
| 205 | +### Adding Callout Boxes |
| 206 | + |
| 207 | +Use these to highlight important information: |
| 208 | + |
| 209 | +```markdown |
| 210 | +!!!tip |
| 211 | + Helpful tips and shortcuts |
| 212 | + |
| 213 | +!!!note |
| 214 | + Important information to remember |
| 215 | + |
| 216 | +!!!warning |
| 217 | + Potential issues or caveats |
| 218 | +``` |
0 commit comments