From 6d382830e63e192997efc49564db5ac41046dcca Mon Sep 17 00:00:00 2001 From: Ole Eskild Steensen Date: Wed, 24 Jan 2024 11:54:08 +0100 Subject: [PATCH] Fix dg-path issues --- manifest-beta.json | 2 +- manifest.json | 2 +- src/dg-testVault/013 Custom path.md | 4 ++++ .../014 Customer path and permalink.md | 5 ++++ src/test/snapshot/snapshot.md | 23 ++++++++++++++++--- src/utils/utils.ts | 5 +++- versions.json | 1 + 7 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 src/dg-testVault/013 Custom path.md create mode 100644 src/dg-testVault/014 Customer path and permalink.md diff --git a/manifest-beta.json b/manifest-beta.json index eb2d11eb..0812ada2 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "digitalgarden", "name": "Digital Garden", - "version": "2.56.1", + "version": "2.56.2", "minAppVersion": "0.12.0", "description": "Publish your notes to the web for others to enjoy. For free.", "author": "Ole Eskild Steensen", diff --git a/manifest.json b/manifest.json index eb2d11eb..0812ada2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "digitalgarden", "name": "Digital Garden", - "version": "2.56.1", + "version": "2.56.2", "minAppVersion": "0.12.0", "description": "Publish your notes to the web for others to enjoy. For free.", "author": "Ole Eskild Steensen", diff --git a/src/dg-testVault/013 Custom path.md b/src/dg-testVault/013 Custom path.md new file mode 100644 index 00000000..4e963d61 --- /dev/null +++ b/src/dg-testVault/013 Custom path.md @@ -0,0 +1,4 @@ +--- +dg-publish: true +dg-path: custom path/should also write to permalink +--- diff --git a/src/dg-testVault/014 Customer path and permalink.md b/src/dg-testVault/014 Customer path and permalink.md new file mode 100644 index 00000000..f2df8357 --- /dev/null +++ b/src/dg-testVault/014 Customer path and permalink.md @@ -0,0 +1,5 @@ +--- +dg-publish: true +dg-path: custom path/should not overwrite permalink +dg-permalink: custom link/shouldBeDifferentToPath +--- diff --git a/src/test/snapshot/snapshot.md b/src/test/snapshot/snapshot.md index 6bac31a6..d25546dc 100644 --- a/src/test/snapshot/snapshot.md +++ b/src/test/snapshot/snapshot.md @@ -222,7 +222,8 @@ This file should have createdAt: 2020-01-01 {"dg-publish":true,"permalink":"/011-custom-updated-at/","updated":"2021-01-01"} --- -This file should have createdAt: 2021-01-01 +This file should have updatedAt: 2021-01-01 + ========== 012 Callouts.md ========== @@ -326,6 +327,22 @@ this is just text i guess +========== +013 Custom path.md +========== +--- +{"dg-publish":true,"dg-path":"custom path/should also write to permalink","permalink":"/custom-path/should-also-write-to-permalink/"} +--- + + +========== +014 Customer path and permalink.md +========== +--- +{"dg-publish":true,"dg-path":"custom path/should not overwrite permalink","dg-permalink":"custom link/shouldBeDifferentToPath","permalink":"/custom link/shouldBeDifferentToPath/"} +--- + + ========== E Embeds/E02 PNG published.md ========== @@ -698,7 +715,7 @@ P Plugins/PD Dataview/PD3 Inline JS queries.md 3 -102 +106

A paragraph

/img/user/A Assets/travolta.png @@ -713,7 +730,7 @@ P Plugins/PD Dataview/PD4 DataviewJs queries.md

Header 2

PD4 DataviewJs queries

-
name4link
005 Custom filters005 Custom filters
006 Custom title006 Custom title
007 Custom permalink007 Custom permalink
011 Custom updatedAt011 Custom updatedAt
+
name6link
006 Custom title006 Custom title
005 Custom filters005 Custom filters
007 Custom permalink007 Custom permalink
011 Custom updatedAt011 Custom updatedAt
013 Custom path013 Custom path
014 Customer path and permalink014 Customer path and permalink
/img/user/A Assets/travolta.png diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 99196e17..e8a6db9e 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -28,7 +28,10 @@ function generateUrlPath(filePath: string, slugifyPath = true): string { if (!filePath) { return filePath; } - const extensionLessPath = filePath.substring(0, filePath.lastIndexOf(".")); + + const extensionLessPath = filePath.contains(".") + ? filePath.substring(0, filePath.lastIndexOf(".")) + : filePath; if (!slugifyPath) { return extensionLessPath + "/"; diff --git a/versions.json b/versions.json index 5899cebb..90197928 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { + "2.56.2": "0.12.0", "2.56.1": "0.12.0", "2.56.0": "0.12.0", "2.55.1": "0.12.0",