dirindex

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package dirindex provides functionality for generating directory listings with customizable templates and translations.

Index

Constants

This section is empty.

Variables

View Source
var Translations = map[string]Translation{}/* 164 elements not displayed */

Translations is a map where keys are language codes and values are Translation structs containing localized text.

Functions

func DirIndex

func DirIndex(fsys fs.StatFS, enable bool, basePath, rootPath string) (func(http.Handler) http.Handler, error)

DirIndex creates middleware for handling directory listing in an HTTP file server. If enabled, it generates an HTML page showing the directory's contents using a predefined template. If it is not enabled, a 403-Forbidden is produced instead of the directory listing. The middleware skips directory listing when serving files or paths with index.html present.

Types

type FileEntry

type FileEntry struct {
	Name       string
	Info       fs.FileInfo
	LinkTarget string
}

FileEntry represents an entry in a directory, containing its name, file information, and symlink target if applicable.

type Translation

type Translation struct {
	ListingName  string
	Name         string
	Size         string
	LastModified string
	RTL          bool
}

Translation represents a localized version of a resource with fields for its name, size, and modification information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL