|
4 | 4 |
|
5 | 5 | > Where the Arab digital world meets, trades, and grows. |
6 | 6 |
|
7 | | -## 🚀 Quick Start |
| 7 | +## Dependencies |
8 | 8 |
|
9 | | -### Prerequisites |
| 9 | +| Tool | Version | Install (macOS) | Required | |
| 10 | +|------|---------|-----------------|----------| |
| 11 | +| Ruby | 3.3+ | `brew install ruby` | ✅ | |
| 12 | +| Bundler | 2.5+ | `gem install bundler` | ✅ | |
| 13 | +| WebP | latest | `brew install webp` | Optional | |
10 | 14 |
|
11 | | -- Ruby 3.3+ (install via Homebrew: `brew install ruby`) |
12 | | -- Bundler (`gem install bundler`) |
| 15 | +> ⚠️ **macOS users**: Add Homebrew Ruby to PATH — the system Ruby (2.6) won't work. |
| 16 | +> ```bash |
| 17 | +> echo 'export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.4.0/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc |
| 18 | +> ``` |
13 | 19 |
|
14 | | -### Setup |
| 20 | +## Quick Start |
15 | 21 |
|
16 | 22 | ```bash |
17 | | -# Clone the repository |
18 | 23 | git clone https://github.com/DigitalBazaarHub/digitalbazaar.github.io.git |
19 | 24 | cd digitalbazaar.github.io |
20 | | - |
21 | | -# Install dependencies |
22 | 25 | make install |
23 | | - |
24 | | -# Start local development server |
25 | 26 | make serve |
26 | 27 | ``` |
27 | 28 |
|
28 | | -Visit [http://localhost:4000](http://localhost:4000) to see the site. |
| 29 | +Visit [http://localhost:4000](http://localhost:4000) |
29 | 30 |
|
30 | | -## 🛠️ Local Development Environment Setup |
| 31 | +## Commands |
31 | 32 |
|
32 | | -### System Requirements |
33 | | - |
34 | | -| Requirement | Version | Notes | |
35 | | -|-------------|---------|-------| |
36 | | -| **Ruby** | 3.3+ (recommended 3.4.x) | macOS system Ruby (2.6) will NOT work | |
37 | | -| **Bundler** | 2.5+ | Gem dependency manager | |
38 | | -| **Jekyll** | 4.4+ | Static site generator (installed via Bundler) | |
39 | | -| **macOS** | 12+ | Or Linux/WSL2 on Windows | |
| 33 | +| Command | Description | |
| 34 | +|---------|-------------| |
| 35 | +| `make install` | Install dependencies | |
| 36 | +| `make serve` | Dev server with live reload | |
| 37 | +| `make prod-build` | Production build (run before committing) | |
| 38 | +| `make build` | Build static site | |
| 39 | +| `make clean` | Remove generated files | |
| 40 | +| `make fonts` | Download self-hosted fonts | |
| 41 | +| `make images` | Optimize images (PNG/JPG) | |
| 42 | +| `make images-webp` | Convert to WebP (requires `webp`) | |
40 | 43 |
|
41 | | -### macOS Setup (Homebrew) |
| 44 | +## Workflows |
42 | 45 |
|
43 | | -The system Ruby on macOS is outdated and won't work. Install Ruby via Homebrew: |
| 46 | +### Adding a New Article |
44 | 47 |
|
45 | 48 | ```bash |
46 | | -# 1. Install Homebrew (if not installed) |
47 | | -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
48 | | - |
49 | | -# 2. Install Ruby |
50 | | -brew install ruby |
51 | | - |
52 | | -# 3. Add Ruby to your PATH (add to ~/.zshrc or ~/.bashrc) |
53 | | -echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc |
54 | | -echo 'export PATH="/opt/homebrew/lib/ruby/gems/3.4.0/bin:$PATH"' >> ~/.zshrc |
| 49 | +# 1. Create the post file |
| 50 | +touch _posts/$(date +%Y-%m-%d)-my-article-slug.md |
55 | 51 |
|
56 | | -# 4. Reload your shell |
57 | | -source ~/.zshrc |
58 | | - |
59 | | -# 5. Verify Ruby version (should show 3.3+ not 2.6) |
60 | | -ruby --version |
61 | | -# Expected: ruby 3.4.x (2024-xx-xx revision xxxxxxxx) |
62 | | - |
63 | | -# 6. Install Bundler |
64 | | -gem install bundler |
65 | | -``` |
66 | | - |
67 | | -> ⚠️ **Important**: If `ruby --version` still shows `2.6.x`, your PATH is not configured correctly. The Homebrew Ruby must come BEFORE the system Ruby in your PATH. |
68 | | -
|
69 | | -### Linux Setup (Ubuntu/Debian) |
70 | | - |
71 | | -```bash |
72 | | -# Install dependencies |
73 | | -sudo apt update |
74 | | -sudo apt install ruby-full build-essential zlib1g-dev |
| 52 | +# 2. Add front matter and content (see template below) |
75 | 53 |
|
76 | | -# Add gem path to ~/.bashrc |
77 | | -echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc |
78 | | -echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc |
79 | | -source ~/.bashrc |
| 54 | +# 3. Preview locally |
| 55 | +make serve |
80 | 56 |
|
81 | | -# Install Bundler |
82 | | -gem install bundler |
| 57 | +# 4. Build and commit |
| 58 | +make prod-build |
| 59 | +git add . |
| 60 | +git commit -m "Add new article: My Article Title" |
| 61 | +git push |
83 | 62 | ``` |
84 | 63 |
|
85 | | -### Project Setup |
86 | | - |
87 | | -Once Ruby is properly installed: |
| 64 | +### Updating Assets (Logo, Fonts, Images) |
88 | 65 |
|
89 | 66 | ```bash |
90 | | -# Clone the repository |
91 | | -git clone https://github.com/DigitalBazaarHub/digitalbazaar.github.io.git |
92 | | -cd digitalbazaar.github.io |
| 67 | +# 1. Replace source files in assets/img/ (keep originals) |
93 | 68 |
|
94 | | -# Install gem dependencies |
95 | | -make install |
| 69 | +# 2. Regenerate optimized versions |
| 70 | +make images # Creates resized PNG/JPG |
| 71 | +make images-webp # Creates WebP versions |
96 | 72 |
|
97 | | -# Download self-hosted fonts (optional but recommended) |
| 73 | +# 3. If updating fonts |
98 | 74 | make fonts |
99 | 75 |
|
100 | | -# Start the development server |
101 | | -make serve |
102 | | -``` |
103 | | - |
104 | | -### Verify Your Environment |
105 | | - |
106 | | -```bash |
107 | | -# Check all versions |
108 | | -ruby --version # Should be 3.3+ |
109 | | -bundler --version # Should be 2.5+ |
110 | | -jekyll --version # Should be 4.4+ (after make install) |
111 | | - |
112 | | -# Check Ruby location (should NOT be /usr/bin/ruby) |
113 | | -which ruby |
114 | | -# Expected: /opt/homebrew/opt/ruby/bin/ruby (macOS) |
115 | | -``` |
116 | | - |
117 | | -### Troubleshooting |
118 | | - |
119 | | -| Problem | Solution | |
120 | | -|---------|----------| |
121 | | -| `Could not find 'bundler'` | Wrong Ruby version. Check `which ruby` — must be Homebrew Ruby, not system | |
122 | | -| `bundle: command not found` | Run `gem install bundler` with correct Ruby | |
123 | | -| `Permission denied` on gems | Don't use `sudo`. Fix your PATH or use `GEM_HOME` | |
124 | | -| Fonts not loading | Run `make fonts` to download self-hosted fonts | |
125 | | -| Port 4000 in use | Kill existing: `pkill -f jekyll` or use `--port 4001` | |
126 | | - |
127 | | -### Environment Variables |
128 | | - |
129 | | -The `Makefile` automatically sets the Ruby PATH for Homebrew installations: |
130 | | - |
131 | | -```makefile |
132 | | -RUBY_PATH := /opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.4.0/bin |
133 | | -``` |
134 | | - |
135 | | -If your Ruby is installed elsewhere, update this path in the `Makefile`. |
136 | | - |
137 | | -## 📋 Available Commands |
138 | | - |
139 | | -Run `make help` to see all available commands: |
140 | | - |
141 | | -| Command | Description | |
142 | | -|---------|-------------| |
143 | | -| `make help` | Show all available commands | |
144 | | -| `make install` | Install Ruby gem dependencies | |
145 | | -| `make update` | Update all gems to latest versions | |
146 | | -| `make serve` | Start local dev server with live reload | |
147 | | -| `make serve-drafts` | Start server with draft posts visible | |
148 | | -| `make build` | Build the static site (output to `_site/`) | |
149 | | -| `make prod-build` | Build for production (minified) | |
150 | | -| `make clean` | Remove generated files and caches | |
151 | | -| `make fonts` | Download self-hosted fonts (DM Sans + Tajawal) | |
152 | | - |
153 | | -### ⚠️ Before Committing |
154 | | - |
155 | | -Always run a production build before committing your changes: |
156 | | - |
157 | | -```bash |
| 76 | +# 4. Build and commit |
158 | 77 | make prod-build |
| 78 | +git add . |
| 79 | +git commit -m "Update assets" |
| 80 | +git push |
159 | 81 | ``` |
160 | 82 |
|
161 | | -This is especially important when: |
162 | | -- **Changing CSS/SCSS** — Ensures styles are properly compiled and minified |
163 | | -- **Adding new pages or layouts** — Catches Liquid template errors |
164 | | -- **Modifying `_config.yml`** — Validates configuration changes |
| 83 | +## Writing Articles |
165 | 84 |
|
166 | | -The production build will fail fast on errors that might not appear during `make serve`. |
167 | | - |
168 | | -> 💡 **Tip**: Consider adding `make prod-build` to a pre-commit hook for automatic verification. |
169 | | -
|
170 | | -## 📁 Project Structure |
171 | | - |
172 | | -``` |
173 | | -├── _config.yml # Jekyll configuration |
174 | | -├── _data/ |
175 | | -│ ├── strings_ar.yml # Arabic UI strings |
176 | | -│ ├── strings_en.yml # English UI strings |
177 | | -│ ├── categories.yml # Article categories |
178 | | -│ └── rules.yml # Community rules (bilingual) |
179 | | -├── _docs/ # Design system documentation |
180 | | -├── _includes/ # Reusable components |
181 | | -├── _layouts/ # Page templates |
182 | | -├── _posts/ # Blog articles |
183 | | -├── ar/ # Arabic pages |
184 | | -├── en/ # English pages |
185 | | -├── assets/ |
186 | | -│ ├── css/styles.scss # Main stylesheet (Sass) |
187 | | -│ ├── fonts/ # Self-hosted fonts (woff2) |
188 | | -│ └── img/ # Images |
189 | | -├── scripts/ |
190 | | -│ └── download-fonts.sh # Font download script |
191 | | -├── .github/workflows/ # GitHub Actions for deployment |
192 | | -├── Gemfile # Ruby dependencies |
193 | | -├── Gemfile.lock # Locked dependency versions |
194 | | -└── Makefile # Development commands |
195 | | -``` |
196 | | - |
197 | | -## ✍️ Writing Articles |
198 | | - |
199 | | -Create a new file in `_posts/` with the format `YYYY-MM-DD-slug.md`: |
| 85 | +Create `_posts/YYYY-MM-DD-slug.md`: |
200 | 86 |
|
201 | 87 | ```yaml |
202 | 88 | --- |
203 | 89 | layout: article |
204 | | -title: "Your Article Title" |
205 | | -author: "Author Name" |
| 90 | +title: "Your Title" |
| 91 | +author: "Name" |
206 | 92 | date: 2025-01-15 |
207 | | -lang: ar # 'ar' or 'en' |
208 | | -category: community # See _data/categories.yml |
209 | | -author_type: team # 'team' or 'member' |
| 93 | +lang: ar # 'ar' or 'en' |
| 94 | +category: community # See _data/categories.yml |
| 95 | +author_type: team # 'team' or 'member' |
210 | 96 | excerpt: "Brief description" |
211 | | -read_time: 5 |
| 97 | +read_time: 5 # Minutes |
212 | 98 | --- |
213 | 99 |
|
214 | | -Your content here... |
| 100 | +Your content here (supports Markdown and HTML)... |
215 | 101 | ``` |
216 | 102 |
|
217 | | -## 🌐 Deployment |
| 103 | +## Project Structure |
218 | 104 |
|
219 | | -The site automatically deploys to GitHub Pages when you push to `main`. |
220 | | - |
221 | | -- **Live site**: [https://digitalbazaarhub.github.io](https://digitalbazaarhub.github.io) |
222 | | -- **Deployment**: GitHub Actions (see `.github/workflows/jekyll.yml`) |
223 | | - |
224 | | -## 🎨 Design System |
225 | | - |
226 | | -- **Fonts**: Tajawal (Arabic), DM Sans (English) |
227 | | -- **Colors**: Sand, Saffron, Terracotta, Marigold, Teal, Night |
228 | | -- **RTL/LTR**: Automatic based on language |
229 | | - |
230 | | -See `_docs/` for detailed design documentation. |
| 105 | +``` |
| 106 | +_config.yml # Jekyll config |
| 107 | +_data/ # Translations & content (strings_ar.yml, strings_en.yml, rules.yml) |
| 108 | +_includes/ # Components |
| 109 | +_layouts/ # Templates |
| 110 | +_posts/ # Articles |
| 111 | +ar/, en/ # Language-specific pages |
| 112 | +assets/css/ # Styles (SCSS) |
| 113 | +assets/fonts/ # Self-hosted fonts |
| 114 | +assets/img/ # Images |
| 115 | +Makefile # Dev commands |
| 116 | +``` |
231 | 117 |
|
232 | | -## 📜 License |
| 118 | +## Deployment |
233 | 119 |
|
234 | | -MIT License — see [LICENSE](LICENSE) |
| 120 | +Pushes to `main` auto-deploy via GitHub Actions → [digitalbazaarhub.github.io](https://digitalbazaarhub.github.io) |
235 | 121 |
|
236 | 122 | --- |
237 | 123 |
|
|
0 commit comments