|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Code @ LHC is a Hugo-based static site showcasing open source cybersecurity projects from the Luxembourg House of Cybersecurity (LHC), including projects from CIRCL and NC3. The site is deployed automatically to GitHub Pages when pushing to the `theme_kode` branch. |
| 8 | + |
| 9 | +## Essential Commands |
| 10 | + |
| 11 | +### Setup |
| 12 | +```bash |
| 13 | +# Clone with theme submodules |
| 14 | +git submodule update --init --recursive |
| 15 | + |
| 16 | +# Install optional Node.js dependencies (if needed by theme) |
| 17 | +npm ci |
| 18 | +``` |
| 19 | + |
| 20 | +### Development |
| 21 | +```bash |
| 22 | +# Run local dev server with drafts enabled |
| 23 | +hugo server -D --disableFastRender |
| 24 | + |
| 25 | +# Access at http://localhost:1313 |
| 26 | +``` |
| 27 | + |
| 28 | +### Build & Testing |
| 29 | +```bash |
| 30 | +# Production build (matches CI pipeline) |
| 31 | +hugo --cleanDestinationDir --gc --minify |
| 32 | + |
| 33 | +# Build with strict error checking |
| 34 | +hugo --panicOnWarning |
| 35 | +``` |
| 36 | + |
| 37 | +## Architecture |
| 38 | + |
| 39 | +### Content Management |
| 40 | +- **Project pages**: Each project is a Markdown file in `content/projects/` with TOML front matter |
| 41 | +- **Dynamic README fetching**: The `{{< readme >}}` shortcode (`layouts/shortcodes/readme.html`) fetches and renders the project's README.md directly from GitHub using the `repository` front matter field |
| 42 | +- **Homepage configuration**: `data/homepage.yml` controls the homepage layout and content sections |
| 43 | + |
| 44 | +### Required Front Matter for Projects |
| 45 | +```toml |
| 46 | ++++ |
| 47 | +title = "Project Name" |
| 48 | +author = "CIRCL" # or "NC3" |
| 49 | +description = "Brief description" |
| 50 | +logo = "logo-project.png" # Must exist in static/img/ |
| 51 | +weight = 10 # Controls display order |
| 52 | +draft = false |
| 53 | +repository = "org/repo" # GitHub repo path for {{< readme >}} shortcode |
| 54 | +tags = ["projects", "tag1", "tag2"] |
| 55 | ++++ |
| 56 | +``` |
| 57 | + |
| 58 | +### Theme System |
| 59 | +- Primary theme: `kode` (located in `themes/kode/`) |
| 60 | +- Themes are **git submodules** - always sync before editing theme assets |
| 61 | +- Override theme templates by placing files in root `layouts/` directory |
| 62 | +- Custom shortcodes: `layouts/shortcodes/` (readme.html, osm.html, rawhtml.html) |
| 63 | + |
| 64 | +### Static Assets |
| 65 | +- `static/img/` - Project logos and images (served as-is) |
| 66 | +- `static/images/` - Banner and site images |
| 67 | +- `assets/sass/` - Source styles (processed by Hugo's asset pipeline) |
| 68 | +- `public/` - Generated build output (never edit manually, excluded from git) |
| 69 | + |
| 70 | +### Configuration |
| 71 | +- `config.toml` - Main Hugo configuration |
| 72 | + - Base URL: https://code.lhc.lu |
| 73 | + - Theme: kode |
| 74 | + - Hugo version used in CI: 0.108.0 (specified in `.github/workflows/hugo.yml`) |
| 75 | + - Social links and menu configuration |
| 76 | + |
| 77 | +## Code Style (from .editorconfig) |
| 78 | + |
| 79 | +- **Default**: 4-space indentation |
| 80 | +- **HTML/CSS/JS/YAML**: 2-space indentation |
| 81 | +- **Makefiles**: Tab indentation |
| 82 | +- **Encoding**: UTF-8 with LF line endings |
| 83 | +- **Markdown**: May retain intentional double trailing spaces (for line breaks) |
| 84 | +- Always include trailing newline |
| 85 | + |
| 86 | +## Commit Message Format |
| 87 | + |
| 88 | +Follow existing pattern: `type: [scope] message` |
| 89 | + |
| 90 | +Examples: |
| 91 | +- `new: [project] Added Range42` |
| 92 | +- `fix: [md] Fixing content regression` |
| 93 | +- `new: [doc] Added LICENCE and README` |
| 94 | +- `new: [pic] Added scandale logo` |
| 95 | + |
| 96 | +Use imperative verbs and keep unrelated changes in separate commits. |
| 97 | + |
| 98 | +## Git Workflow |
| 99 | + |
| 100 | +- **Main branch**: `theme_kode` (this is the default deployment branch) |
| 101 | +- Development branches are merged via pull requests |
| 102 | +- GitHub Actions automatically deploys to Pages on push to `theme_kode` |
| 103 | +- Always run `hugo --cleanDestinationDir --minify` before submitting PR |
| 104 | + |
| 105 | +## Adding a New Project |
| 106 | + |
| 107 | +1. Create `content/projects/project-name.md` with required front matter |
| 108 | +2. Add project logo to `static/img/logo-project-name.png` |
| 109 | +3. Ensure the `repository` field points to the correct GitHub repo (org/repo format) |
| 110 | +4. Set `draft = false` when ready to publish |
| 111 | +5. The `{{< readme >}}` shortcode will automatically fetch and display the project's README from GitHub |
| 112 | + |
| 113 | +## Testing Checklist |
| 114 | + |
| 115 | +- Use `draft = true` while developing new content |
| 116 | +- Run `hugo server -D` to preview drafts locally |
| 117 | +- Run `hugo --panicOnWarning` to catch errors (broken front matter, missing assets, shortcode errors) |
| 118 | +- Verify project README renders correctly via the `{{< readme >}}` shortcode |
| 119 | +- Check for browser console warnings after Sass changes |
| 120 | +- Ensure all project logos exist in `static/img/` |
0 commit comments