|
| 1 | +# PowerShell.org Hugo Site - AI Coding Agent Instructions |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +PowerShell.org is a **Hugo static site** (v0.128+) serving as the community hub for PowerShell enthusiasts. The site is built with a custom theme (`powershell-community`) and uses Tailwind CSS with FontAwesome icons. Content is organized into five main sections: Home, Podcast, Summit, Community, and Learning. |
| 5 | + |
| 6 | +## Architecture & Key Concepts |
| 7 | + |
| 8 | +### Hugo Structure |
| 9 | +- **Configuration**: [../hugo.yaml](../hugo.yaml) - Contains site metadata, menu structure, taxonomies, and environment-specific parameters |
| 10 | +- **Theme**: [../themes/powershell-community/](../themes/powershell-community/) - Custom theme with Tailwind CSS styling |
| 11 | +- **Content**: [../content/](../content/) - Markdown files organized by section (_index.md for section pages) |
| 12 | +- **Data**: [../data/community_stats.json](../data/community_stats.json) - Dynamic data source for community statistics |
| 13 | +- **Outputs**: Site builds to both [../public/](../public/) (GitHub Pages) and [../docs/](../docs/) directories |
| 14 | + |
| 15 | +### Content Organization |
| 16 | +Each major section has its own directory under `content/`: |
| 17 | +- `community/` - Community hub with discussion stats |
| 18 | +- `learning/` - Educational resources |
| 19 | +- `podcast/` - Podcast listing (podcast details in `hugo.yaml`) |
| 20 | +- `summit/` - Event information (summit config in `hugo.yaml`) |
| 21 | +- `_index.md` files define section landing pages and front matter |
| 22 | + |
| 23 | +### Layout System |
| 24 | +- **Base Template**: [../themes/powershell-community/layouts/_default/baseof.html](../themes/powershell-community/layouts/_default/baseof.html) - HTML structure, RSS feeds, Open Graph metadata |
| 25 | +- **Home Layout**: [../themes/powershell-community/layouts/index.html](../themes/powershell-community/layouts/index.html) - Hero section, stats display |
| 26 | +- **Section Layout**: [../themes/powershell-community/layouts/list.html](../themes/powershell-community/layouts/list.html) - Used for Podcast, Summit, Learning sections |
| 27 | +- **Partials**: [../themes/powershell-community/layouts/partials/](../themes/powershell-community/layouts/partials/) - header.html, footer.html (reusable components) |
| 28 | + |
| 29 | +### Dynamic Data Flow |
| 30 | +The `community_stats.json` file is accessed in templates via `.Site.Data.community_stats`. It includes: |
| 31 | +- `activities` - Recent forum activity list |
| 32 | +- `stats` - Total topics, posts, active users, weekly counts |
| 33 | +- `last_updated` - ISO timestamp for cache-busting |
| 34 | + |
| 35 | +## Development Workflow |
| 36 | + |
| 37 | +### Local Development |
| 38 | +```bash |
| 39 | +npm run dev # Hugo server on http://localhost:1313 with drafts enabled (-D) |
| 40 | +npm run build # Production build with garbage collection and minification |
| 41 | +npm run preview # Production server for testing |
| 42 | +``` |
| 43 | + |
| 44 | +**Key flags**: |
| 45 | +- `-D` (drafts): Enable `draft: true` pages |
| 46 | +- `--disableFastRender`: Prevents caching issues during development |
| 47 | +- `--gc --minify`: Garbage collection and CSS/JS minification for production |
| 48 | + |
| 49 | +### Build Artifacts |
| 50 | +- **Development**: Live-reloaded on file changes; accessible at http://localhost:1313 |
| 51 | +- **Production**: Generated in `public/` and `docs/` directories |
| 52 | +- **RSS feeds**: Auto-generated for home, sections, and taxonomy pages |
| 53 | + |
| 54 | +## Key Patterns & Conventions |
| 55 | + |
| 56 | +### Front Matter Structure |
| 57 | +All markdown files follow Hugo convention with YAML front matter: |
| 58 | +```yaml |
| 59 | +--- |
| 60 | +title: "Page Title" |
| 61 | +description: "Short description for meta tags and summaries" |
| 62 | +draft: false # Set to true to exclude from builds (visible with -D) |
| 63 | +date: 2024-01-01T00:00:00Z |
| 64 | +categories: ["category-name"] |
| 65 | +tags: ["tag1", "tag2"] |
| 66 | +author: "Author Name" |
| 67 | +--- |
| 68 | +``` |
| 69 | + |
| 70 | +### Styling & UI Components |
| 71 | +- **Framework**: Tailwind CSS utility classes (in HTML templates) |
| 72 | +- **Icons**: FontAwesome 6+ (`<i class="fas fa-icon-name"></i>`) |
| 73 | +- **Color Scheme**: Blues for primary (hero/nav), purples for highlights (podcast), gradients for sections |
| 74 | +- **Responsive Design**: Mobile-first with `sm:`, `lg:` breakpoints |
| 75 | + |
| 76 | +Example header component pattern (from baseof.html): |
| 77 | +```html |
| 78 | +<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}"> |
| 79 | +``` |
| 80 | + |
| 81 | +### Section-Specific Configurations |
| 82 | +Located in [../hugo.yaml](../hugo.yaml) `params`: |
| 83 | +- **Podcast**: `podcast.title`, `podcast.description`, `podcast.feed_url` |
| 84 | +- **Summit**: `summit.year`, `summit.dates`, `summit.location`, `summit.registration_url` |
| 85 | +- **Social Links**: Twitter, YouTube, GitHub, Discord, Bluesky URLs in `social` map |
| 86 | + |
| 87 | +Update these centrally; templates access via `.Site.Params.podcast.title` etc. |
| 88 | + |
| 89 | +### Taxonomy System |
| 90 | +Defined in [../hugo.yaml](../hugo.yaml): |
| 91 | +```yaml |
| 92 | +taxonomies: |
| 93 | + category: categories |
| 94 | + tag: tags |
| 95 | + author: authors |
| 96 | +``` |
| 97 | +Each taxonomy auto-generates list pages at `/categories/`, `/tags/`, `/authors/` with RSS feeds. |
| 98 | + |
| 99 | +## Critical Integration Points |
| 100 | + |
| 101 | +### RSS & Feed Generation |
| 102 | +- Enabled globally: `enableRSSFeed: true` |
| 103 | +- Output formats: Home and sections generate both HTML and RSS |
| 104 | +- RSS feed links in baseof.html use `{{ range .AlternativeOutputFormats }}` |
| 105 | +- Podcast feed URL points to external podbean: `https://powershellpodcast.podbean.com/feed/` |
| 106 | + |
| 107 | +### GitHub Pages Deployment |
| 108 | +- Site publishes to `docs/` folder for GitHub Pages compatibility |
| 109 | +- Both `public/` and `docs/` are build outputs (verify in CI/CD scripts) |
| 110 | + |
| 111 | +### Open Graph & Social Sharing |
| 112 | +All pages auto-generate OG metadata in baseof.html: |
| 113 | +- Images: Look for `og:image` in front matter; defaults to site image |
| 114 | +- Title/Description: Pulled from front matter, fallback to site defaults |
| 115 | + |
| 116 | +## Common Tasks |
| 117 | + |
| 118 | +### Adding a New Content Page |
| 119 | +1. Create `content/section/_index.md` or `content/section/page-name.md` |
| 120 | +2. Include front matter with `title`, `description`, `draft: false` |
| 121 | +3. Write content in Markdown (supports HTML with `unsafe: true` in markup config) |
| 122 | +4. Run `npm run dev` to preview |
| 123 | + |
| 124 | +### Updating Section Metadata |
| 125 | +Edit [../hugo.yaml](../hugo.yaml) `params` section (podcast, summit, social) - no page rebuild needed for config. |
| 126 | + |
| 127 | +### Modifying Layouts |
| 128 | +- Edit templates in [../themes/powershell-community/layouts/](../themes/powershell-community/layouts/) |
| 129 | +- Use Hugo template functions: `.Title`, `.Content`, `range .Pages`, `.Truncate`, `.Permalink` |
| 130 | +- Hot-reload works with `npm run dev`; Tailwind classes apply without rebuild |
| 131 | + |
| 132 | +### Accessing Data |
| 133 | +```html |
| 134 | +<!-- Community stats in templates --> |
| 135 | +{{ .Site.Data.community_stats.stats.total_topics }} |
| 136 | +{{ range .Site.Data.community_stats.activities }} |
| 137 | + {{ .message }} <!-- Current activity --> |
| 138 | +{{ end }} |
| 139 | +``` |
| 140 | + |
| 141 | +## Dependencies & Version Requirements |
| 142 | +- **Hugo**: v0.128+ (using goldmark markdown, pagination v2 syntax) |
| 143 | +- **Node.js**: For npm scripts (package.json defines hugo-extended and node-fetch) |
| 144 | +- **Tailwind CSS**: Utility-first CSS framework (classes in HTML templates) |
| 145 | +- **FontAwesome**: Icon library (v6+ icons via CDN in baseof.html) |
| 146 | + |
| 147 | +## Avoid These Pitfalls |
| 148 | +1. **Don't use old Hugo pagination syntax** (`{{ .Paginate }}` without `.Paginate` assignment) - v0.128+ requires explicit assignment |
| 149 | +2. **Don't commit `public/` or `docs/` folders** - Generated by CI/CD |
| 150 | +3. **Draft pages are hidden by default** - Must add `-D` flag to `hugo server` or set `draft: false` in front matter |
| 151 | +4. **Section aliases/redirects** - If moving content, add `aliases: ["/old-path/"]` to front matter |
| 152 | +5. **Hardcoding URLs** - Use `.Permalink`, `.RelRef`, and `.Site.BaseURL` instead |
0 commit comments