Fossil User Forum

In addition to readme, show index file on /dir page
Login

In addition to readme, show index file on /dir page

In addition to readme, show index file on /dir page

(1) By SENOO, Ken (senooken) on 2025-01-05 22:50:14 [source]

I am also trying to create an official website for my project using fossil's Web UI and embedded document function (/doc or /dir).

At that time, I noticed that /doc displays an index file, and /dir displays a readme file.

In addition to the embedded document in /doc, I would like a directory description to be displayed for user convenience when browsing source files in /dir. However, at present, index files and readme files have almost the same role and are required for /doc and /dir.

When considering display on the web, I think that an index file, where the /filename can be omitted, is more appropriate than a readme, and I think it would be more convenient if the index file was also displayed in /dir.

The modifications are simple and straightforward. What do you think?

$ ./fossil version
This is fossil version 2.26 [787a45e58a] 2025-01-04 14:40:00 UTC
./fossil diff
Index: src/browse.c
==================================================================
--- src/browse.c
+++ src/browse.c
@@ -392,18 +392,18 @@
   if( P("noreadme")!=0 ){
     style_finish_page();
     return;
   }
 
-  /* If the directory contains a readme file, then display its content below
+  /* If the directory contains a readme or index file, then display its content below
   ** the list of files
   */
   db_prepare(&q,
     "SELECT x, u FROM localfiles"
     " WHERE x COLLATE nocase IN"
     " ('readme','readme.txt','readme.md','readme.wiki','readme.markdown',"
-    " 'readme.html') ORDER BY x COLLATE uintnocase LIMIT 1;"
+    " 'readme.html','index.html','index.wiki','index.md') ORDER BY x COLLATE uintnocase LIMIT 1;"
   );
   if( db_step(&q)==SQLITE_ROW ){
     const char *zName = db_column_text(&q,0);
     const char *zUuid = db_column_text(&q,1);
     if( zUuid ){