@terrymooreii/sia 2.1.6 → 2.1.8
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.
- package/bin/cli.js +7 -0
- package/docs/README.md +61 -1
- package/docs/creating-themes.md +216 -1
- package/docs/imgs/logo-sia-t.png +0 -0
- package/docs/imgs/logo-sia.png +0 -0
- package/docs/imgs/sia2.png +0 -0
- package/lib/assets.js +14 -7
- package/lib/build.js +8 -4
- package/lib/init.js +3 -3
- package/lib/templates.js +11 -4
- package/lib/theme-resolver.js +175 -0
- package/lib/theme.js +1524 -0
- package/package.json +1 -1
- package/readme.md +110 -1
- package/themes/developer/pages/blog.njk +1 -1
- package/themes/developer/pages/feed.njk +1 -1
- package/themes/developer/pages/index.njk +1 -1
- package/themes/developer/pages/notes.njk +1 -1
- package/themes/magazine/layouts/post.njk +2 -2
- package/themes/magazine/pages/blog.njk +1 -1
- package/themes/magazine/pages/index.njk +3 -3
- package/themes/magazine/pages/notes.njk +1 -1
- package/themes/main/includes/footer.njk +1 -1
- package/themes/main/pages/blog.njk +1 -1
- package/themes/main/pages/index.njk +2 -2
- package/themes/main/pages/tag.njk +3 -3
- package/themes/minimal/includes/footer.njk +1 -1
- package/themes/minimal/pages/blog.njk +1 -1
- package/themes/minimal/pages/index.njk +1 -1
- package/themes/minimal/pages/tag.njk +3 -3
- package/themes/minimal/pages/tags.njk +1 -1
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
1
5
|
# Sia
|
|
2
6
|
|
|
3
7
|
A simple, powerful static site generator built with JavaScript. Similar to Eleventy/11ty, Sia supports markdown, front matter, Nunjucks templates, and more.
|
|
@@ -11,8 +15,10 @@ A simple, powerful static site generator built with JavaScript. Similar to Eleve
|
|
|
11
15
|
- **Tags & Categories** - Organize content with tags, auto-generated tag pages
|
|
12
16
|
- **Pagination** - Built-in pagination for listing pages
|
|
13
17
|
- **Image Support** - Automatic image copying and organization
|
|
18
|
+
- **Static Assets** - Support for favicons, fonts, and other static files
|
|
14
19
|
- **Live Reload** - Development server with hot reloading
|
|
15
|
-
- **Themes** - Built-in themes (main, minimal) with light/dark mode toggle
|
|
20
|
+
- **Themes** - Built-in themes (main, minimal, developer, magazine) with light/dark mode toggle
|
|
21
|
+
- **Custom Themes** - Create and share themes as npm packages (`sia-theme-*`)
|
|
16
22
|
- **RSS Feed** - Automatic RSS feed generation
|
|
17
23
|
- **YAML/JSON Config** - Flexible configuration options
|
|
18
24
|
|
|
@@ -88,6 +94,10 @@ my-site/
|
|
|
88
94
|
│ ├── pages/ # Static pages
|
|
89
95
|
│ ├── notes/ # Short notes/tweets
|
|
90
96
|
│ └── images/ # Images
|
|
97
|
+
├── assets/ # Static assets (optional)
|
|
98
|
+
├── static/ # Static assets (optional)
|
|
99
|
+
├── public/ # Static assets (optional)
|
|
100
|
+
├── favicon.ico # Site favicon (optional)
|
|
91
101
|
├── _layouts/ # Custom layouts (optional)
|
|
92
102
|
├── _includes/ # Custom includes (optional)
|
|
93
103
|
├── styles/ # Custom CSS (optional)
|
|
@@ -144,6 +154,58 @@ server:
|
|
|
144
154
|
|
|
145
155
|
When `showDrafts` is set to `true`, draft posts (posts with `draft: true` in front matter) will be included in the development server build. This is useful for previewing draft content locally. Drafts are always excluded from production builds.
|
|
146
156
|
|
|
157
|
+
## Static Assets
|
|
158
|
+
|
|
159
|
+
Sia automatically copies static assets during the build process. You can place static files in any of these locations:
|
|
160
|
+
|
|
161
|
+
- **`assets/`** - Place files in `assets/` at the project root
|
|
162
|
+
- **`static/`** - Place files in `static/` at the project root
|
|
163
|
+
- **`public/`** - Place files in `public/` at the project root
|
|
164
|
+
- **Root directory** - Place `favicon.ico` directly in the project root
|
|
165
|
+
|
|
166
|
+
All files from these directories will be copied to the `dist/` folder during build, preserving their directory structure.
|
|
167
|
+
|
|
168
|
+
### Supported File Types
|
|
169
|
+
|
|
170
|
+
Static assets include:
|
|
171
|
+
- **Favicons** - `.ico` files (favicon.ico can be in root or asset directories)
|
|
172
|
+
- **Fonts** - `.woff`, `.woff2`, `.ttf`, `.eot`
|
|
173
|
+
- **Documents** - `.pdf`, `.txt`, `.json`, `.xml`
|
|
174
|
+
- **Scripts** - `.js` files
|
|
175
|
+
- **Stylesheets** - `.css` files (though custom CSS is better placed in `styles/`)
|
|
176
|
+
- **Images** - All image formats (though images are better placed in `src/images/`)
|
|
177
|
+
|
|
178
|
+
### Example Structure
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
my-site/
|
|
182
|
+
├── assets/
|
|
183
|
+
│ ├── favicon.ico
|
|
184
|
+
│ ├── robots.txt
|
|
185
|
+
│ ├── manifest.json
|
|
186
|
+
│ └── fonts/
|
|
187
|
+
│ └── custom-font.woff2
|
|
188
|
+
├── static/
|
|
189
|
+
│ └── documents/
|
|
190
|
+
│ └── resume.pdf
|
|
191
|
+
└── favicon.ico # Also supported in root
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
During build, these will be copied to:
|
|
195
|
+
```
|
|
196
|
+
dist/
|
|
197
|
+
├── assets/
|
|
198
|
+
│ ├── favicon.ico
|
|
199
|
+
│ ├── robots.txt
|
|
200
|
+
│ ├── manifest.json
|
|
201
|
+
│ └── fonts/
|
|
202
|
+
│ └── custom-font.woff2
|
|
203
|
+
├── static/
|
|
204
|
+
│ └── documents/
|
|
205
|
+
│ └── resume.pdf
|
|
206
|
+
└── favicon.ico
|
|
207
|
+
```
|
|
208
|
+
|
|
147
209
|
## Front Matter
|
|
148
210
|
|
|
149
211
|
Each markdown file can have YAML front matter:
|
|
@@ -391,8 +453,55 @@ sia build --clean
|
|
|
391
453
|
sia new post "Title"
|
|
392
454
|
sia new page "Title"
|
|
393
455
|
sia new note "Content"
|
|
456
|
+
|
|
457
|
+
# Create a new theme package
|
|
458
|
+
sia theme my-theme
|
|
459
|
+
sia theme my-theme --quick # Skip prompts
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
## Custom Theme Packages
|
|
463
|
+
|
|
464
|
+
Sia supports external themes distributed as npm packages. Theme packages must be named `sia-theme-{name}`.
|
|
465
|
+
|
|
466
|
+
### Using an External Theme
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
# Install the theme package
|
|
470
|
+
npm install sia-theme-awesome
|
|
471
|
+
|
|
472
|
+
# Configure in _config.yml
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
```yaml
|
|
476
|
+
theme:
|
|
477
|
+
name: awesome # Uses sia-theme-awesome package
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Sia resolves themes in this order:
|
|
481
|
+
1. Built-in themes (`main`, `minimal`, `developer`, `magazine`)
|
|
482
|
+
2. npm packages matching `sia-theme-{name}`
|
|
483
|
+
|
|
484
|
+
### Creating a Theme Package
|
|
485
|
+
|
|
486
|
+
```bash
|
|
487
|
+
# Generate a new theme scaffold
|
|
488
|
+
sia theme my-theme
|
|
489
|
+
|
|
490
|
+
# This creates sia-theme-my-theme/ with:
|
|
491
|
+
# - package.json (properly configured)
|
|
492
|
+
# - README.md (documentation template)
|
|
493
|
+
# - layouts/, includes/, pages/, styles/
|
|
394
494
|
```
|
|
395
495
|
|
|
496
|
+
After customizing, publish to npm:
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
cd sia-theme-my-theme
|
|
500
|
+
npm publish
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
See [Creating Themes](docs/creating-themes.md) for detailed documentation.
|
|
504
|
+
|
|
396
505
|
## Upgrading
|
|
397
506
|
|
|
398
507
|
If you installed Sia as a dependency (recommended):
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<a href="{{ post.url }}">{{ post.title }}</a>
|
|
24
24
|
</h2>
|
|
25
25
|
|
|
26
|
-
<p class="card-excerpt">{{ post.
|
|
26
|
+
<p class="card-excerpt">{{ post.excerptHtml | safe }}</p>
|
|
27
27
|
|
|
28
28
|
<div class="card-meta">
|
|
29
29
|
<span class="card-date">{{ post.date | date('short') }}</span>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<link>{{ site.url }}{{ post.url }}</link>
|
|
13
13
|
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
|
|
14
14
|
<pubDate>{{ post.date | date('rss') }}</pubDate>
|
|
15
|
-
<description><![CDATA[{{ post.
|
|
15
|
+
<description><![CDATA[{{ post.excerptHtml | safe }}]]></description>
|
|
16
16
|
{% for tag in post.tags %}
|
|
17
17
|
<category>{{ tag }}</category>
|
|
18
18
|
{% endfor %}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
{% for note in collections.notes | limit(3) %}
|
|
52
52
|
<article class="note-card">
|
|
53
53
|
<time class="note-time">{{ note.date | date('short') }}</time>
|
|
54
|
-
<div class="note-preview">{{ note.
|
|
54
|
+
<div class="note-preview">{{ note.excerptHtml | safe }}</div>
|
|
55
55
|
<a href="{{ note.url }}" class="note-link">Read more →</a>
|
|
56
56
|
</article>
|
|
57
57
|
{% endfor %}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
{{ note.date | date('full') }}
|
|
17
17
|
</time>
|
|
18
18
|
<div class="timeline-body">
|
|
19
|
-
<div class="note-text">{{ note.
|
|
19
|
+
<div class="note-text">{{ note.excerptHtml | safe }}</div>
|
|
20
20
|
<a href="{{ note.url }}" class="read-more">Continue reading →</a>
|
|
21
21
|
</div>
|
|
22
22
|
{% if note.tags %}
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
<h1 class="article-title">{{ page.title }}</h1>
|
|
14
14
|
|
|
15
|
-
{% if page.
|
|
16
|
-
<p class="article-subtitle">{{ page.
|
|
15
|
+
{% if page.excerptHtml | safe %}
|
|
16
|
+
<p class="article-subtitle">{{ page.excerptHtml | safe }}</p>
|
|
17
17
|
{% endif %}
|
|
18
18
|
|
|
19
19
|
<div class="article-byline">
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<h2 class="row-title">
|
|
17
17
|
<a href="{{ post.url }}">{{ post.title }}</a>
|
|
18
18
|
</h2>
|
|
19
|
-
<p class="row-excerpt">{{ post.
|
|
19
|
+
<p class="row-excerpt">{{ post.excerptHtml | safe }}</p>
|
|
20
20
|
<div class="row-meta">
|
|
21
21
|
<span class="row-author">{{ post.author or site.author }}</span>
|
|
22
22
|
<span class="meta-separator">·</span>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<h2 class="featured-title">
|
|
15
15
|
<a href="{{ featuredPost.url | url }}">{{ featuredPost.title }}</a>
|
|
16
16
|
</h2>
|
|
17
|
-
<p class="featured-excerpt">{{ featuredPost.
|
|
17
|
+
<p class="featured-excerpt">{{ featuredPost.excerptHtml | safe }}</p>
|
|
18
18
|
<div class="featured-meta">
|
|
19
19
|
<span class="featured-author">{{ featuredPost.author or site.author }}</span>
|
|
20
20
|
<span class="featured-date">{{ featuredPost.date | date('long') }}</span>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<h3 class="card-title">
|
|
42
42
|
<a href="{{ post.url | url }}">{{ post.title }}</a>
|
|
43
43
|
</h3>
|
|
44
|
-
<p class="card-excerpt">{{ post.
|
|
44
|
+
<p class="card-excerpt">{{ post.excerptHtml | safe }}</p>
|
|
45
45
|
<div class="card-meta">
|
|
46
46
|
<time datetime="{{ post.date | date('iso') }}">{{ post.date | date('short') }}</time>
|
|
47
47
|
<span>·</span>
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
{% for note in collections.notes | limit(3) %}
|
|
65
65
|
<article class="note-preview">
|
|
66
66
|
<time datetime="{{ note.date | date('iso') }}">{{ note.date | date('short') }}</time>
|
|
67
|
-
<p>{{ note.
|
|
67
|
+
<p>{{ note.excerptHtml | safe }}</p>
|
|
68
68
|
<a href="{{ note.url | url }}" class="note-link">Read note →</a>
|
|
69
69
|
</article>
|
|
70
70
|
{% endfor %}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{{ note.date | date('full') }}
|
|
14
14
|
</time>
|
|
15
15
|
<div class="note-content">
|
|
16
|
-
<p>{{ note.
|
|
16
|
+
<p>{{ note.excerptHtml | safe }}</p>
|
|
17
17
|
<a href="{{ note.url }}" class="note-read-more">Continue reading →</a>
|
|
18
18
|
</div>
|
|
19
19
|
{% if note.tags %}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="container">
|
|
3
3
|
<p class="footer-text">
|
|
4
4
|
© {{ "now" | date('year') }} {{ site.author or site.title }}.
|
|
5
|
-
Built with <a href="https://github.com/
|
|
5
|
+
Built with <a href="https://github.com/terrymooreii/sia">Sia</a>.
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
<nav class="footer-nav">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</span>
|
|
27
27
|
{% endif %}
|
|
28
28
|
</div>
|
|
29
|
-
<p class="post-card-excerpt">{{ post.
|
|
29
|
+
<p class="post-card-excerpt">{{ post.excerptHtml | safe }}</p>
|
|
30
30
|
</article>
|
|
31
31
|
{% else %}
|
|
32
32
|
<p class="empty-message">No posts yet. Create your first post with <code>npx sia new post "My First Post"</code></p>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<div class="notes-grid">
|
|
45
45
|
{% for note in collections.notes | limit(3) %}
|
|
46
46
|
<article class="note-card">
|
|
47
|
-
<div class="note-card-content">{{ note.
|
|
47
|
+
<div class="note-card-content">{{ note.excerptHtml | safe }}</div>
|
|
48
48
|
<footer class="note-card-footer">
|
|
49
49
|
<time datetime="{{ note.date | date('iso') }}">{{ note.date | date('full_time') }}</time>
|
|
50
50
|
<a href="{{ note.url }}" class="note-card-link">View →</a>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{% for post in posts %}
|
|
11
11
|
<article class="post-card">
|
|
12
12
|
<h2 class="post-card-title">
|
|
13
|
-
<a href="{{ post.url }}">{{ post.title or post.
|
|
13
|
+
<a href="{{ post.url }}">{{ post.title or post.excerptHtml | safe }}</a>
|
|
14
14
|
{% if post.draft %}<span class="draft-badge">Draft</span>{% endif %}
|
|
15
15
|
</h2>
|
|
16
16
|
<div class="post-card-meta">
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
{% endfor %}
|
|
27
27
|
</div>
|
|
28
28
|
{% endif %}
|
|
29
|
-
{% if post.
|
|
30
|
-
<p class="post-card-excerpt">{{ post.
|
|
29
|
+
{% if post.excerptHtml %}
|
|
30
|
+
<p class="post-card-excerpt">{{ post.excerptHtml | safe }}</p>
|
|
31
31
|
{% endif %}
|
|
32
32
|
</article>
|
|
33
33
|
{% endfor %}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="container">
|
|
3
3
|
<p class="footer-text">
|
|
4
4
|
© {{ "now" | date('year') }} {{ site.author or site.title }}.
|
|
5
|
-
Built with <a href="https://github.com/
|
|
5
|
+
Built with <a href="https://github.com/terrymooreii/sia">Sia</a>.
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
<nav class="footer-nav">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</span>
|
|
27
27
|
{% endif %}
|
|
28
28
|
</div>
|
|
29
|
-
<p class="post-card-excerpt">{{ post.
|
|
29
|
+
<p class="post-card-excerpt">{{ post.excerptHtml | safe }}</p>
|
|
30
30
|
</article>
|
|
31
31
|
{% else %}
|
|
32
32
|
<p class="empty-message">No posts yet. Create your first post with <code>npx sia new post "My First Post"</code></p>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{% for post in posts %}
|
|
11
11
|
<article class="post-card">
|
|
12
12
|
<h2 class="post-card-title">
|
|
13
|
-
<a href="{{ post.url }}">{{ post.title or post.
|
|
13
|
+
<a href="{{ post.url }}">{{ post.title or post.excerptHtml | safe }}</a>
|
|
14
14
|
{% if post.draft %}<span class="draft-badge">Draft</span>{% endif %}
|
|
15
15
|
</h2>
|
|
16
16
|
<div class="post-card-meta">
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
{% endfor %}
|
|
27
27
|
</div>
|
|
28
28
|
{% endif %}
|
|
29
|
-
{% if post.
|
|
30
|
-
<p class="post-card-excerpt">{{ post.
|
|
29
|
+
{% if post.excerptHtml %}
|
|
30
|
+
<p class="post-card-excerpt">{{ post.excerptHtml | safe }}</p>
|
|
31
31
|
{% endif %}
|
|
32
32
|
</article>
|
|
33
33
|
{% endfor %}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<ul class="tag-posts">
|
|
21
21
|
{% for item in tag.items | limit(5) %}
|
|
22
22
|
<li>
|
|
23
|
-
<a href="{{ item.url }}">{{ item.title or item.
|
|
23
|
+
<a href="{{ item.url }}">{{ item.title or item.excerptHtml | safe }}</a>
|
|
24
24
|
<time datetime="{{ item.date | date('iso') }}">{{ item.date | date('short') }}</time>
|
|
25
25
|
</li>
|
|
26
26
|
{% endfor %}
|