diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-21 15:26:53 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-21 15:26:53 +0700 |
| commit | aed750e52ceccc18e3143995d43b0b1de21055b9 (patch) | |
| tree | bf99213ee6ffb05fdcf04f2807bd6866f7a011ca | |
| parent | 8a9875b04ea369039b22c1d9d6ff260506cf35fb (diff) | |
| download | ciigo-aed750e52ceccc18e3143995d43b0b1de21055b9.tar.xz | |
all: add server option to automatically generate index HTML
If the requested path is directory and no "index.html" file exist in
that directory, ciigo server will render list of files as "index.html"
automatically.
| -rw-r--r-- | serve_options.go | 6 | ||||
| -rw-r--r-- | server.go | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/serve_options.go b/serve_options.go index 6995547..7e7dacf 100644 --- a/serve_options.go +++ b/serve_options.go @@ -20,6 +20,12 @@ type ServeOptions struct { ConvertOptions + // If true, the serve command generate index.html automatically if its + // not exist in the directory. + // The index.html contains the list of files inside the requested + // path. + EnableIndexHTML bool + // IsDevelopment if set to true, it will serve the ConvertOptions.Root // directory directly and watch all asciidoc files for changes and // convert it. @@ -47,8 +47,9 @@ func newServer(opts *ServeOptions) (srv *server, err error) { } var httpdOpts = libhttp.ServerOptions{ - Memfs: opts.Mfs, - Address: opts.Address, + Memfs: opts.Mfs, + Address: opts.Address, + EnableIndexHTML: opts.EnableIndexHTML, } srv.http, err = libhttp.NewServer(httpdOpts) |
