getfilepress 0.1.13 → 0.1.17
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/package.json +1 -1
- package/packages/app/src/lib/genie/GeniePanel.svelte +5 -7
- package/packages/app/src/routes/+layout.svelte +2 -1
- package/packages/core/src/lib/components/SiteHeader.svelte +8 -1
- package/packages/core/src/lib/config.ts +18 -5
- package/packages/import/src/write-site.ts +1 -1
- package/scripts/create-site.mjs +1 -0
package/package.json
CHANGED
|
@@ -856,13 +856,11 @@
|
|
|
856
856
|
Cancel
|
|
857
857
|
</button>
|
|
858
858
|
{:else}
|
|
859
|
-
|
|
860
|
-
type="button"
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
Activate
|
|
865
|
-
</button>
|
|
859
|
+
{#if !isActive}
|
|
860
|
+
<button type="button" disabled={loading} onclick={() => activate(v.id)}>
|
|
861
|
+
Activate
|
|
862
|
+
</button>
|
|
863
|
+
{/if}
|
|
866
864
|
<button type="button" disabled={loading} onclick={() => startRename(v)}>
|
|
867
865
|
Rename
|
|
868
866
|
</button>
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
{#if criticalTheme}
|
|
23
23
|
{@html `<style data-filepress-critical>${criticalTheme}</style>`}
|
|
24
24
|
{/if}
|
|
25
|
-
<link rel="icon" href="/favicon.
|
|
25
|
+
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
26
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
26
27
|
<link rel="alternate" type="application/rss+xml" title={config.title} href="/rss.xml" />
|
|
27
28
|
</svelte:head>
|
|
28
29
|
|
|
@@ -11,7 +11,14 @@
|
|
|
11
11
|
<div class="site-id">
|
|
12
12
|
<a class="site-title" href="/">
|
|
13
13
|
{#if site.logo}
|
|
14
|
-
<img
|
|
14
|
+
<img
|
|
15
|
+
class="site-logo"
|
|
16
|
+
src={site.logo}
|
|
17
|
+
alt=""
|
|
18
|
+
onerror={(e) => {
|
|
19
|
+
e.currentTarget.hidden = true;
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
15
22
|
{/if}
|
|
16
23
|
<span class="site-brand-copy">
|
|
17
24
|
<span class="site-wordmark">{site.title}</span>
|
|
@@ -46,7 +46,11 @@ export interface SiteConfig {
|
|
|
46
46
|
tagline: string;
|
|
47
47
|
/** One-line lede shown on the index hero, or null for no visible hero. */
|
|
48
48
|
lede: string | null;
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Path to a masthead logo image (site-relative, e.g. "/logo.png"), or null for text.
|
|
51
|
+
* When omitted, defaults to `/logo.png` (drop the file in `static/`).
|
|
52
|
+
* Pass `""` or `null` to keep a text-only masthead.
|
|
53
|
+
*/
|
|
50
54
|
logo: string | null;
|
|
51
55
|
/**
|
|
52
56
|
* Absolute or site-relative Open Graph image (e.g. "/logo.png").
|
|
@@ -90,7 +94,8 @@ export interface SiteConfigInput {
|
|
|
90
94
|
description?: string;
|
|
91
95
|
tagline?: string;
|
|
92
96
|
lede?: string;
|
|
93
|
-
logo
|
|
97
|
+
/** Masthead logo path. Omitted → `/logo.png`. Empty or null → text only. */
|
|
98
|
+
logo?: string | null;
|
|
94
99
|
/** Open Graph image path; defaults to `logo`. */
|
|
95
100
|
ogImage?: string;
|
|
96
101
|
author?: string;
|
|
@@ -136,6 +141,13 @@ export function postsIndexPath(site: Pick<SiteConfig, 'homePage'>): string {
|
|
|
136
141
|
return site.homePage ? '/posts' : '/';
|
|
137
142
|
}
|
|
138
143
|
|
|
144
|
+
/** Omitted → fallback. Explicit null or blank → no image. */
|
|
145
|
+
function optionalChromePath(value: string | null | undefined, whenOmitted: string | null): string | null {
|
|
146
|
+
if (value === undefined) return whenOmitted;
|
|
147
|
+
if (value === null) return null;
|
|
148
|
+
return value.trim() || null;
|
|
149
|
+
}
|
|
150
|
+
|
|
139
151
|
/**
|
|
140
152
|
* Validate and normalize a site's config, applying defaults. Fails loudly if a
|
|
141
153
|
* required field is missing (edge case 19) so a misconfigured site never builds
|
|
@@ -161,6 +173,8 @@ export function defineFilepressConfig(input: SiteConfigInput): SiteConfig {
|
|
|
161
173
|
);
|
|
162
174
|
}
|
|
163
175
|
|
|
176
|
+
const logo = optionalChromePath(input.logo, '/logo.png');
|
|
177
|
+
|
|
164
178
|
const defaultNav: NavItem[] = homePage
|
|
165
179
|
? [
|
|
166
180
|
{ label: 'Home', href: '/' },
|
|
@@ -177,9 +191,8 @@ export function defineFilepressConfig(input: SiteConfigInput): SiteConfig {
|
|
|
177
191
|
description,
|
|
178
192
|
tagline: (input.tagline ?? '').trim() || description || title,
|
|
179
193
|
lede: (input.lede ?? '').trim() || null,
|
|
180
|
-
logo
|
|
181
|
-
ogImage:
|
|
182
|
-
(input.ogImage ?? '').trim() || (input.logo ?? '').trim() || null,
|
|
194
|
+
logo,
|
|
195
|
+
ogImage: (input.ogImage ?? '').trim() || logo,
|
|
183
196
|
url: url.replace(/\/+$/, ''),
|
|
184
197
|
author: (input.author ?? '').trim() || title,
|
|
185
198
|
postsPerPage:
|
|
@@ -262,7 +262,7 @@ export async function writeSite(
|
|
|
262
262
|
];
|
|
263
263
|
const imageMap = await downloadImages(allImages, staticDir);
|
|
264
264
|
await downloadRootAssets(ir.assets ?? [], staticDir);
|
|
265
|
-
// Layout
|
|
265
|
+
// Layout prefers /favicon.png, then /favicon.svg — keep an svg so prerender has a fallback.
|
|
266
266
|
const faviconDest = join(staticDir, 'favicon.svg');
|
|
267
267
|
if (!existsSync(faviconDest) && existsSync(DEFAULT_FAVICON)) {
|
|
268
268
|
copyFileSync(DEFAULT_FAVICON, faviconDest);
|