New site can't be initialized with Index.org
precompute opened this issue · comments
Describe the bug
A new emanote website can't be init with an index.org
file, but an index.md
file works.
To Reproduce
Make a new (empty) folder, run emanote run
.
Then make an index.org
file.
The following error occurs:
[Info#emanote] [13:34:17] Reading file: /exte/zz/temp/containers/emanote/test/index.org
emanote: attempt to encode an ambiguous route: /
CallStack (from HasCallStack):
error, called at src/Relude/Debug.hs:288:11 in relude-1.0.0.1-FljEYV1xvt0It3QAhHDj9h:Relude.Debug
error, called at src/Emanote/Route/SiteRoute/Class.hs:82:9 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote.Route.SiteRoute.Class
emanoteRouteEncoder, called at src/Emanote.hs:49:27 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote
[Info#ema.ws.02] Connected
emanote: attempt to encode an ambiguous route: /
CallStack (from HasCallStack):
error, called at src/Relude/Debug.hs:288:11 in relude-1.0.0.1-FljEYV1xvt0It3QAhHDj9h:Relude.Debug
error, called at src/Emanote/Route/SiteRoute/Class.hs:82:9 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote.Route.SiteRoute.Class
emanoteRouteEncoder, called at src/Emanote.hs:49:27 in emanote-0.8.1.9-HyYSgEmSPbbLE977WJ0nPm:Emanote
Using an index.md
file works without any errors.
This issue is also present when creating the "example.org" file for a folder named "example" (or similar).
Steps to Reproduce
mkdir Blog
touch Blog.org
.md
works as expected.
@t-e-r-m I can only reproduce the bug with index.org
.
example.org
works fine for me.
Getting rid of https://github.com/EmaApps/emanote/blob/master/default/index.md from the default layer will resolve this, but that's not really a solution because emanote assumes the default index note always exists:
emanote: attempt to encode missing note: LMLRoute_Md R[/index.md]
CallStack (from HasCallStack):
error, called at src/Relude/Debug.hs:288:11 in relude-1.0.0.1-FljEYV1xvt0It3QAhHDj9h:Relude.Debug
error, called at src/Emanote/Route/SiteRoute/Class.hs:102:10 in main:Emanote.Route.SiteRoute.Class
encodeResourceRoute, called at src/Emanote/Route/SiteRoute/Class.hs:84:9 in main:Emanote.Route.SiteRoute.Class
emanoteRouteEncoder, called at src/Emanote.hs:49:27 in main:Emanote
@t-e-r-m You can try this patch for now, though a proper fix needs to be thought of carefully to resolve this in master
.
diff --git a/src/Emanote/Route/SiteRoute/Class.hs b/src/Emanote/Route/SiteRoute/Class.hs
index 6cbe6e0c..cf4fb607 100644
--- a/src/Emanote/Route/SiteRoute/Class.hs
+++ b/src/Emanote/Route/SiteRoute/Class.hs
@@ -121,10 +121,7 @@ decodeGeneratedRoute model fp =
Rel.RRTFound note ->
Just $ noteFileSiteRoute note
Rel.RRTAmbiguous notes ->
- Just $ ambiguousNoteURLsRoute notes
- ambiguousNoteURLsRoute :: NonEmpty N.Note -> SiteRoute
- ambiguousNoteURLsRoute ns =
- SiteRoute_AmbiguousR ("/" <> fp) (N._noteRoute <$> ns)
+ Just $ noteFileSiteRoute $ last notes
noteFileSiteRoute :: N.Note -> SiteRoute
noteFileSiteRoute =
Thank you for the patch.
Should be resolved in #387 once it is merged; please re-open if the problem still occurs.