@mel000000/weweb-dynamic-metadata 1.0.13 → 1.0.15
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/src/core/file-processor.js +12 -2
package/package.json
CHANGED
|
@@ -111,7 +111,7 @@ function generateReferenceHtml(id, title, relativeTemplatePath) {
|
|
|
111
111
|
})
|
|
112
112
|
.catch(error => {
|
|
113
113
|
console.error('Failed to load template:', error);
|
|
114
|
-
document.body.innerHTML = '<h1>Error loading
|
|
114
|
+
document.body.innerHTML = '<h1>Error loading article</h1><p>Please refresh the page</p>';
|
|
115
115
|
});
|
|
116
116
|
})();
|
|
117
117
|
</script>
|
|
@@ -188,6 +188,7 @@ export async function processFiles() {
|
|
|
188
188
|
|
|
189
189
|
// Create reference files using the ORIGINAL working logic
|
|
190
190
|
const relativeTemplatePath = '../_param/index.html';
|
|
191
|
+
let referencesCreated = 0;
|
|
191
192
|
|
|
192
193
|
for (const [id, metadata] of metadataMap.entries()) {
|
|
193
194
|
try {
|
|
@@ -199,6 +200,15 @@ export async function processFiles() {
|
|
|
199
200
|
generateReferenceHtml(id, metadata.title, relativeTemplatePath)
|
|
200
201
|
);
|
|
201
202
|
|
|
203
|
+
// Create a small metadata.js reference
|
|
204
|
+
const contentMetadataJsPath = path.join(contentRootDir, 'metadata.js');
|
|
205
|
+
const metadataReference = `// Reference to central metadata file
|
|
206
|
+
// This file points to the main metadata.js
|
|
207
|
+
// The actual metadata is loaded from /article/metadata.js`;
|
|
208
|
+
|
|
209
|
+
await fs.writeFile(contentMetadataJsPath, metadataReference, 'utf-8');
|
|
210
|
+
|
|
211
|
+
referencesCreated++;
|
|
202
212
|
} catch (error) {
|
|
203
213
|
// Silently continue
|
|
204
214
|
}
|
|
@@ -210,10 +220,10 @@ export async function processFiles() {
|
|
|
210
220
|
succeeded: successCount,
|
|
211
221
|
failed: failCount,
|
|
212
222
|
metadataEntries: metadataMap.size,
|
|
223
|
+
referencesCreated
|
|
213
224
|
});
|
|
214
225
|
|
|
215
226
|
summary.totalMetadataEntries += metadataMap.size;
|
|
216
|
-
summary.outputDirectories.push(contentRootDir);
|
|
217
227
|
}
|
|
218
228
|
|
|
219
229
|
summary.duration = ((Date.now() - startTime) / 1000).toFixed(2);
|