jekyll-theme-zer0 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,9 @@
28
28
  href="{{ link.url | relative_url }}"
29
29
  {%- if link.url == page.url -%} aria-current="page"{%- endif -%}
30
30
  >
31
+ {%- if link.icon -%}
32
+ <i class="{{site.default_icon}} {{ link.icon }} me-2"></i>
33
+ {%- endif -%}
31
34
  {{ link.title }}
32
35
  </a>
33
36
 
@@ -65,6 +68,9 @@
65
68
  href="{{ link.url | relative_url }}"
66
69
  {%- if link.url == page.url -%} aria-current="page"{%- endif -%}
67
70
  >
71
+ {%- if link.icon -%}
72
+ <i class="{{site.default_icon}} {{ link.icon }} me-2"></i>
73
+ {%- endif -%}
68
74
  {{ link.title }}
69
75
  </a>
70
76
  </li>
@@ -0,0 +1,273 @@
1
+ # Statistics Layout Documentation
2
+
3
+ ## Overview
4
+
5
+ The Zer0-Mistakes theme now includes a comprehensive statistics layout system that provides detailed analytics and metrics for Jekyll sites. This system consists of a dedicated layout and modular include components that can be easily customized and extended.
6
+
7
+ ## Files Structure
8
+
9
+ ```
10
+ _layouts/
11
+ └── stats.html # Main statistics layout
12
+
13
+ _includes/stats/
14
+ ├── stats-header.html # Page header and navigation
15
+ ├── stats-overview.html # Overview metrics cards
16
+ ├── stats-categories.html # Categories analysis
17
+ ├── stats-tags.html # Tags analysis and tag cloud
18
+ ├── stats-metrics.html # Additional metrics and facts
19
+ └── stats-no-data.html # Error state for missing data
20
+
21
+ assets/css/
22
+ └── stats.css # Statistics-specific styles
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Basic Setup
28
+
29
+ 1. Create a statistics page using the stats layout:
30
+
31
+ ```yaml
32
+ ---
33
+ title: "Site Statistics Portal"
34
+ description: "Comprehensive analytics and metrics"
35
+ layout: stats
36
+ permalink: /stats/
37
+ ---
38
+
39
+ Your additional content here (optional).
40
+ ```
41
+
42
+ 2. Ensure you have a statistics data file at `_data/content_statistics.yml` with the following structure:
43
+
44
+ ```yaml
45
+ generated_at: "2025-01-27 10:30:00"
46
+ total_posts: 150
47
+ categories:
48
+ - ["development", 45]
49
+ - ["tutorials", 32]
50
+ - ["guides", 28]
51
+ tags:
52
+ - ["javascript", 25]
53
+ - ["python", 20]
54
+ - ["web-development", 18]
55
+ ```
56
+
57
+ ### Components Overview
58
+
59
+ #### stats-header.html
60
+ - Displays page title and description
61
+ - Shows last update timestamp
62
+ - Provides navigation breadcrumbs
63
+ - Includes quick jump links to sections
64
+
65
+ #### stats-overview.html
66
+ - Four key metric cards (Posts, Categories, Tags, Data Status)
67
+ - Color-coded cards with Bootstrap styling
68
+ - Data freshness indicators
69
+ - Summary bar below cards
70
+
71
+ #### stats-categories.html
72
+ - Top categories list with post counts
73
+ - Activity level indicators
74
+ - Summary statistics footer
75
+ - Expandable interface for large datasets
76
+
77
+ #### stats-tags.html
78
+ - Top tags list with usage counts
79
+ - Interactive tag cloud visualization
80
+ - Dynamic font sizing based on usage
81
+ - Hover effects and tooltips
82
+
83
+ #### stats-metrics.html
84
+ - Content overview section
85
+ - Top performers analysis
86
+ - Data health indicators
87
+ - Action buttons (print, refresh, help)
88
+ - Help modal with instructions
89
+
90
+ #### stats-no-data.html
91
+ - Error state when data is missing
92
+ - Clear instructions for generating statistics
93
+ - Troubleshooting information
94
+ - Alternative navigation options
95
+
96
+ ## Customization
97
+
98
+ ### Adding New Sections
99
+
100
+ To add a new statistics section:
101
+
102
+ 1. Create a new include file in `_includes/stats/`:
103
+
104
+ ```html
105
+ <!-- _includes/stats/stats-new-section.html -->
106
+ <div class="card shadow-sm">
107
+ <div class="card-header bg-purple text-white">
108
+ <h3 class="mb-0 fw-bold">
109
+ <i class="bi bi-new-icon me-2"></i> New Section
110
+ </h3>
111
+ </div>
112
+ <div class="card-body">
113
+ <!-- Your content here -->
114
+ </div>
115
+ </div>
116
+ ```
117
+
118
+ 2. Include it in the stats layout:
119
+
120
+ ```html
121
+ <!-- In _layouts/stats.html -->
122
+ {% include stats/stats-new-section.html %}
123
+ ```
124
+
125
+ ### Styling Customization
126
+
127
+ The stats layout uses Bootstrap 5 classes extensively. You can customize the appearance by:
128
+
129
+ 1. **Modifying CSS variables** in `assets/css/stats.css`
130
+ 2. **Overriding Bootstrap classes** with custom styles
131
+ 3. **Adding new utility classes** for specific needs
132
+
133
+ ### Data Source Customization
134
+
135
+ The layout expects data from `site.data.content_statistics`. You can:
136
+
137
+ 1. **Change the data source** by modifying the Liquid template references
138
+ 2. **Add new data fields** to the YAML structure
139
+ 3. **Create multiple data sources** for different statistics types
140
+
141
+ ## Features
142
+
143
+ ### Responsive Design
144
+ - Mobile-first approach
145
+ - Responsive grid layouts
146
+ - Touch-friendly interactions
147
+ - Optimized for all screen sizes
148
+
149
+ ### Accessibility
150
+ - ARIA labels and roles
151
+ - Keyboard navigation support
152
+ - Screen reader compatibility
153
+ - High contrast mode support
154
+
155
+ ### Performance
156
+ - Lazy loading of non-critical elements
157
+ - Optimized CSS delivery
158
+ - Minimal JavaScript footprint
159
+ - Print-optimized styles
160
+
161
+ ### Interactive Elements
162
+ - Hover effects on cards and tags
163
+ - Smooth animations and transitions
164
+ - Modal dialogs for additional information
165
+ - Progress bars with dynamic updates
166
+
167
+ ## Browser Support
168
+
169
+ The statistics layout supports all modern browsers:
170
+ - Chrome 90+
171
+ - Firefox 88+
172
+ - Safari 14+
173
+ - Edge 90+
174
+
175
+ ## Dependencies
176
+
177
+ - Jekyll 4.0+
178
+ - Bootstrap 5.3.3
179
+ - Bootstrap Icons 1.10.3
180
+ - Modern browser with CSS Grid support
181
+
182
+ ## Troubleshooting
183
+
184
+ ### Common Issues
185
+
186
+ 1. **Statistics not displaying**
187
+ - Check that `_data/content_statistics.yml` exists
188
+ - Verify the YAML structure matches the expected format
189
+ - Ensure the data generation script has run successfully
190
+
191
+ 2. **Styling issues**
192
+ - Verify `assets/css/stats.css` is included
193
+ - Check for CSS conflicts with other stylesheets
194
+ - Ensure Bootstrap 5 is properly loaded
195
+
196
+ 3. **JavaScript errors**
197
+ - Check browser console for error messages
198
+ - Verify Bootstrap JS is loaded
199
+ - Ensure no conflicting JavaScript libraries
200
+
201
+ ### Performance Optimization
202
+
203
+ 1. **Large datasets**
204
+ - Implement pagination for large category/tag lists
205
+ - Use lazy loading for secondary statistics
206
+ - Consider caching generated statistics
207
+
208
+ 2. **Mobile optimization**
209
+ - Test on various device sizes
210
+ - Optimize touch interactions
211
+ - Minimize data transfer on mobile
212
+
213
+ ## Examples
214
+
215
+ ### Basic Statistics Page
216
+
217
+ ```markdown
218
+ ---
219
+ title: "Site Analytics"
220
+ description: "Comprehensive site statistics and metrics"
221
+ layout: stats
222
+ permalink: /analytics/
223
+ ---
224
+
225
+ This page provides detailed analytics about our content library.
226
+ ```
227
+
228
+ ### Custom Statistics with Additional Content
229
+
230
+ ```markdown
231
+ ---
232
+ title: "Content Metrics Dashboard"
233
+ description: "Advanced analytics for content creators"
234
+ layout: stats
235
+ permalink: /metrics/
236
+ ---
237
+
238
+ ## Content Performance Insights
239
+
240
+ Our analytics system tracks various metrics to help understand content performance and user engagement.
241
+
242
+ ### Key Metrics
243
+ - Content reach and engagement
244
+ - Category performance trends
245
+ - Tag effectiveness analysis
246
+ - User interaction patterns
247
+
248
+ ### Data Collection
249
+ Statistics are updated daily and include all published content from the past 12 months.
250
+ ```
251
+
252
+ ## Future Enhancements
253
+
254
+ Planned improvements for the statistics layout:
255
+
256
+ 1. **Interactive Charts**: D3.js or Chart.js integration
257
+ 2. **Real-time Updates**: WebSocket-based live statistics
258
+ 3. **Advanced Filters**: Date ranges, category filters
259
+ 4. **Export Functionality**: PDF and CSV export options
260
+ 5. **Comparison Views**: Period-over-period comparisons
261
+ 6. **Custom Dashboards**: User-configurable statistics views
262
+
263
+ ## Contributing
264
+
265
+ To contribute improvements to the statistics layout:
266
+
267
+ 1. Follow the established file structure
268
+ 2. Maintain Bootstrap 5 compatibility
269
+ 3. Include proper documentation
270
+ 4. Test across multiple browsers
271
+ 5. Ensure accessibility compliance
272
+
273
+ For more information, see the main theme documentation.
@@ -0,0 +1,146 @@
1
+ <!--
2
+ ===================================================================
3
+ STATS CATEGORIES COMPONENT
4
+ ===================================================================
5
+
6
+ File: stats-categories.html
7
+ Path: _includes/stats/stats-categories.html
8
+ Purpose: Categories analysis section for statistics dashboard
9
+
10
+ Features:
11
+ - Top categories list with post counts
12
+ - Bootstrap styled card layout
13
+ - Responsive badges for counts
14
+ - Sortable category data
15
+
16
+ Dependencies:
17
+ - Bootstrap 5 for styling
18
+ - Bootstrap Icons for iconography
19
+ - site.data.content_statistics.categories
20
+ ===================================================================
21
+ -->
22
+
23
+ <!-- ================================================ -->
24
+ <!-- CATEGORIES ANALYSIS SECTION -->
25
+ <!-- Top categories with post counts -->
26
+ <!-- ================================================ -->
27
+ <div id="categories" class="card shadow-sm h-100">
28
+ <div class="card-header bg-primary text-white">
29
+ <div class="d-flex align-items-center justify-content-between">
30
+ <h3 class="mb-0 fw-bold">
31
+ <i class="bi bi-folder2-open me-2"></i> Top Categories
32
+ </h3>
33
+ <span class="badge bg-light text-primary">
34
+ {{ site.data.content_statistics.overview.total_categories | default: 0 }}
35
+ </span>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="card-body p-0">
40
+ {% if site.data.content_statistics.categories and site.data.content_statistics.categories.size > 0 %}
41
+
42
+ <!-- Categories List -->
43
+ <div class="list-group list-group-flush">
44
+ {% for category in site.data.content_statistics.categories limit: 15 %}
45
+ <div class="list-group-item d-flex justify-content-between align-items-center py-3">
46
+ <div class="d-flex align-items-center">
47
+ <i class="bi bi-folder text-primary me-3"></i>
48
+ <div>
49
+ <span class="fw-medium">{{ category[0] | capitalize }}</span>
50
+ {% assign max_category = site.data.content_statistics.categories | first %}
51
+ {% assign max_count = max_category[1] | default: 1 %}
52
+ {% assign high_threshold = max_count | times: 0.7 | round %}
53
+ {% assign medium_threshold = max_count | times: 0.4 | round %}
54
+ {% if category[1] >= high_threshold and category[1] > 2 %}
55
+ <br><small class="text-muted">High activity</small>
56
+ {% elsif category[1] >= medium_threshold and category[1] > 1 %}
57
+ <br><small class="text-muted">Medium activity</small>
58
+ {% else %}
59
+ <br><small class="text-muted">Low activity</small>
60
+ {% endif %}
61
+ </div>
62
+ </div>
63
+ <div class="text-end">
64
+ <span class="badge bg-primary rounded-pill fs-6 px-3 py-2">
65
+ {{ category[1] }}
66
+ </span>
67
+ <br><small class="text-muted">posts</small>
68
+ </div>
69
+ </div>
70
+ {% endfor %}
71
+ </div>
72
+
73
+ <!-- Show More Button if there are more categories -->
74
+ {% if site.data.content_statistics.categories.size > 15 %}
75
+ <div class="card-footer bg-light text-center">
76
+ <button class="btn btn-outline-primary btn-sm"
77
+ onclick="toggleAllCategories(this)">
78
+ <i class="bi bi-chevron-down"></i>
79
+ Show {{ site.data.content_statistics.categories.size | minus: 15 }} more categories
80
+ </button>
81
+ </div>
82
+ {% endif %}
83
+
84
+ {% else %}
85
+
86
+ <!-- No Categories Available -->
87
+ <div class="text-center py-5">
88
+ <i class="bi bi-folder-x display-4 text-muted mb-3"></i>
89
+ <h5 class="text-muted">No categories found</h5>
90
+ <p class="text-muted">Categories will appear here once content is categorized.</p>
91
+ </div>
92
+
93
+ {% endif %}
94
+ </div>
95
+
96
+ <!-- Categories Summary Footer -->
97
+ {% if site.data.content_statistics.categories and site.data.content_statistics.categories.size > 0 %}
98
+ <div class="card-footer bg-light">
99
+ <div class="row text-center">
100
+ <div class="col-4">
101
+ <strong class="text-primary">{{ site.data.content_statistics.overview.total_categories | default: 0 }}</strong>
102
+ <br><small class="text-muted">Total</small>
103
+ </div>
104
+ <div class="col-4">
105
+ {% assign top_category = site.data.content_statistics.categories | first %}
106
+ <strong class="text-success">{{ top_category[1] | default: 0 }}</strong>
107
+ <br><small class="text-muted">Most Posts</small>
108
+ </div>
109
+ <div class="col-4">
110
+ {% assign total_posts = 0 %}
111
+ {% for category in site.data.content_statistics.categories %}
112
+ {% assign total_posts = total_posts | plus: category[1] %}
113
+ {% endfor %}
114
+ {% assign avg_posts = total_posts | divided_by: site.data.content_statistics.categories.size %}
115
+ <strong class="text-info">{{ avg_posts | default: 0 }}</strong>
116
+ <br><small class="text-muted">Avg Posts</small>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ {% endif %}
121
+ </div>
122
+
123
+ <!-- ================================================ -->
124
+ <!-- CATEGORIES JAVASCRIPT -->
125
+ <!-- Interactive functionality for categories -->
126
+ <!-- ================================================ -->
127
+ <script>
128
+ function toggleAllCategories(button) {
129
+ // This would expand/collapse additional categories
130
+ // Implementation depends on whether you want to load more data
131
+ // or show/hide existing elements
132
+
133
+ const icon = button.querySelector('i');
134
+ const isExpanded = icon.classList.contains('bi-chevron-up');
135
+
136
+ if (isExpanded) {
137
+ icon.className = 'bi bi-chevron-down';
138
+ button.innerHTML = '<i class="bi bi-chevron-down"></i> Show more categories';
139
+ } else {
140
+ icon.className = 'bi bi-chevron-up';
141
+ button.innerHTML = '<i class="bi bi-chevron-up"></i> Show fewer categories';
142
+ }
143
+
144
+ // Add your expand/collapse logic here
145
+ }
146
+ </script>
@@ -0,0 +1,123 @@
1
+ <!--
2
+ ===================================================================
3
+ STATS HEADER COMPONENT - BOOTSTRAP 5 OPTIMIZED
4
+ ===================================================================
5
+
6
+ File: stats-header.html
7
+ Path: _includes/stats/stats-header.html
8
+ Purpose: Page header for statistics dashboard using Bootstrap 5 classes
9
+
10
+ Features:
11
+ - Bootstrap 5 utility classes for layout and styling
12
+ - Responsive design with Bootstrap breakpoints
13
+ - Bootstrap icons and color system
14
+ - Minimal custom CSS dependencies
15
+
16
+ Dependencies:
17
+ - Bootstrap 5 for styling
18
+ - Bootstrap Icons for iconography
19
+ - Jekyll data variables
20
+ ===================================================================
21
+ -->
22
+
23
+ <!-- ================================================ -->
24
+ <!-- STATS PAGE HEADER -->
25
+ <!-- Title, description, and metadata display -->
26
+ <!-- ================================================ -->
27
+ <div class="row mb-5">
28
+ <div class="col-12">
29
+ <div class="text-center mb-4">
30
+ <!-- Header Icon with Bootstrap classes -->
31
+ <div class="d-inline-flex align-items-center justify-content-center bg-primary bg-gradient rounded-circle p-4 mb-4 shadow-lg stats-header-icon">
32
+ <i class="bi bi-graph-up fs-1 text-white stats-icon-rotate"></i>
33
+ </div>
34
+
35
+ <!-- Title with Bootstrap typography -->
36
+ <h1 class="display-3 mb-3 fw-bold text-primary">
37
+ {{ page.title | default: "Site Statistics Portal" }}
38
+ </h1>
39
+
40
+ <!-- Description with Bootstrap lead class -->
41
+ <p class="lead text-muted mb-4 fs-4">
42
+ {{ page.description | default: "Comprehensive analytics and insights from the knowledge base" }}
43
+ </p>
44
+ </div>
45
+
46
+ <!-- Last Updated Information using Bootstrap alerts -->
47
+ {% if site.data.content_statistics and site.data.content_statistics.generated_at %}
48
+ <div class="alert alert-info border-0 bg-gradient shadow-sm d-flex align-items-center justify-content-between" role="alert">
49
+ <div class="d-flex align-items-center">
50
+ <i class="bi bi-clock me-3 fs-4"></i>
51
+ <span class="fw-medium">
52
+ <strong>Last updated:</strong>
53
+ {{ site.data.content_statistics.generated_at | date: "%B %d, %Y at %I:%M %p" }}
54
+ </span>
55
+ </div>
56
+ <button class="btn btn-outline-info btn-sm" onclick="window.location.reload()">
57
+ <i class="bi bi-arrow-clockwise me-1"></i>
58
+ Refresh
59
+ </button>
60
+ </div>
61
+ {% else %}
62
+ <div class="alert alert-warning border-0 bg-gradient shadow-sm d-flex align-items-center justify-content-between" role="alert">
63
+ <div class="d-flex align-items-center">
64
+ <i class="bi bi-exclamation-triangle me-3 fs-4"></i>
65
+ <span class="fw-medium">
66
+ <strong>Statistics not yet generated.</strong>
67
+ Run <code class="bg-light text-dark px-2 py-1 rounded">ruby _data/generate_statistics.rb</code> to create statistics.
68
+ </span>
69
+ </div>
70
+ <button class="btn btn-outline-warning btn-sm" onclick="window.location.reload()">
71
+ <i class="bi bi-arrow-clockwise me-1"></i>
72
+ Check Again
73
+ </button>
74
+ </div>
75
+ {% endif %}
76
+ </div>
77
+ </div>
78
+
79
+ <!-- ================================================ -->
80
+ <!-- STATS NAVIGATION BREADCRUMBS -->
81
+ <!-- Quick navigation within the stats page -->
82
+ <!-- ================================================ -->
83
+ <div class="row mb-5">
84
+ <div class="col-12">
85
+ <!-- Bootstrap breadcrumb -->
86
+ <nav aria-label="Statistics navigation">
87
+ <ol class="breadcrumb bg-light p-3 rounded shadow-sm">
88
+ <li class="breadcrumb-item">
89
+ <a href="{{ '/' | relative_url }}" class="text-decoration-none">
90
+ <i class="bi bi-house me-1"></i> Home
91
+ </a>
92
+ </li>
93
+ <li class="breadcrumb-item active fw-medium" aria-current="page">
94
+ <i class="bi bi-graph-up me-1"></i> Statistics
95
+ </li>
96
+ </ol>
97
+ </nav>
98
+
99
+ <!-- Quick Jump Navigation using Bootstrap button group -->
100
+ {% if site.data.content_statistics %}
101
+ <div class="text-center">
102
+ <div class="btn-group btn-group-lg shadow-sm d-flex flex-wrap gap-2" role="group" aria-label="Statistics navigation">
103
+ <a href="#overview" class="btn btn-outline-primary flex-fill">
104
+ <i class="bi bi-speedometer2 me-1"></i>
105
+ <span class="d-none d-sm-inline">Overview</span>
106
+ </a>
107
+ <a href="#categories" class="btn btn-outline-success flex-fill">
108
+ <i class="bi bi-folder me-1"></i>
109
+ <span class="d-none d-sm-inline">Categories</span>
110
+ </a>
111
+ <a href="#tags" class="btn btn-outline-info flex-fill">
112
+ <i class="bi bi-tags me-1"></i>
113
+ <span class="d-none d-sm-inline">Tags</span>
114
+ </a>
115
+ <a href="#metrics" class="btn btn-outline-warning flex-fill">
116
+ <i class="bi bi-info-circle me-1"></i>
117
+ <span class="d-none d-sm-inline">Metrics</span>
118
+ </a>
119
+ </div>
120
+ </div>
121
+ {% endif %}
122
+ </div>
123
+ </div>