@daz4126/swifty 1.8.0 → 1.9.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.
- package/README.md +1 -1
- package/init.js +12 -1
- package/package.json +1 -1
- package/swifty.js +4 -4
package/README.md
CHANGED
|
@@ -17,4 +17,4 @@ It also uses convention over configuration to make is super simple to build site
|
|
|
17
17
|
5. Change the `sitename` in `config.yaml`
|
|
18
18
|
6. Add some markdown files to the 'pages' directory
|
|
19
19
|
7. `npx swifty start` to rebuild and start the server
|
|
20
|
-
8. Visit [http://localhost:3000] to see your site
|
|
20
|
+
8. Visit [http://localhost:3000](http://localhost:3000) to see your site
|
package/init.js
CHANGED
|
@@ -17,7 +17,18 @@ const structure = {
|
|
|
17
17
|
"css/": null,
|
|
18
18
|
"js/": null,
|
|
19
19
|
"images/": null,
|
|
20
|
-
"config.yaml":
|
|
20
|
+
"config.yaml": `sitename: Swifty
|
|
21
|
+
breadcrumb_separator: "»"
|
|
22
|
+
breadcrumb_class: swifty_breadcrumb
|
|
23
|
+
link_class: swifty_link
|
|
24
|
+
tag_class: tag
|
|
25
|
+
max_image_size: 800
|
|
26
|
+
|
|
27
|
+
dateFormat:
|
|
28
|
+
weekday: short
|
|
29
|
+
month: short
|
|
30
|
+
day: numeric
|
|
31
|
+
year: numeric`,
|
|
21
32
|
"template.html": `<!DOCTYPE html>
|
|
22
33
|
<html lang="en">
|
|
23
34
|
<head>
|
package/package.json
CHANGED
package/swifty.js
CHANGED
|
@@ -343,7 +343,9 @@ const generateLinkList = async (name,pages) => {
|
|
|
343
343
|
const render = async page => {
|
|
344
344
|
const replacedContent = await replacePlaceholders(page.content, page);
|
|
345
345
|
const htmlContent = marked.parse(replacedContent); // Markdown processed once
|
|
346
|
-
|
|
346
|
+
|
|
347
|
+
const wrappedContent = await applyLayoutAndWrapContent(page, htmlContent);
|
|
348
|
+
const turboHTML = wrappedContent.replace(
|
|
347
349
|
/<a\s+([^>]*?)href="(\/[^"#?]+?)"(.*?)>/g,
|
|
348
350
|
(match, beforeHref, href, afterHref) => {
|
|
349
351
|
// Don't double-add .html
|
|
@@ -352,9 +354,7 @@ const render = async page => {
|
|
|
352
354
|
return `<a ${beforeHref}href="${fullHref}" data-turbo-frame="content" data-turbo-action="advance"${afterHref}>`;
|
|
353
355
|
}
|
|
354
356
|
);
|
|
355
|
-
|
|
356
|
-
const wrappedContent = await applyLayoutAndWrapContent(page, turboHTML);
|
|
357
|
-
return wrappedContent;
|
|
357
|
+
return turboHTML;
|
|
358
358
|
};
|
|
359
359
|
|
|
360
360
|
// Function to read and render the index template
|