[PATCH] autoindex : Add viewport meta tag for responsive scaling to narrow screen devices

vbt at anche.no vbt at anche.no
Sat Nov 7 08:05:34 UTC 2020


# HG changeset patch
# User Var Bhat <vbt at anche.no>
# Date 1604734673 -19800
#      Sat Nov 07 13:07:53 2020 +0530
# Node ID 703eb6ae6cbf2ad87620d8ca4e0788be7e121538
# Parent  554c6ae25ffc634e29adae8b51bef6ddabebea39
ngx_http_autoindex_module: Added viewport meta tag to autoindex html 
rendering

Previously , Auto Indexing Directory didn't include viewport meta tag 
which caused html not to scale to the screen width .
This caused Narrow screen devices (e.g. mobiles) render pages in a 
virtual window or viewport,
which is usually wider than the screen, and then shrink the rendered 
result down so it can all be seen at once.
This required frequent zooming and scrolling as things looked small.
This made autoindexing unresponsive on mobile and other narrow screen 
devices.

This patch makes autoindexing mobile responsive.

diff -r 554c6ae25ffc -r 703eb6ae6cbf 
src/http/modules/ngx_http_autoindex_module.c
--- a/src/http/modules/ngx_http_autoindex_module.c	Fri Nov 06 23:44:54 
2020 +0300
+++ b/src/http/modules/ngx_http_autoindex_module.c	Sat Nov 07 13:07:53 
2020 +0530
@@ -445,7 +445,8 @@

      static u_char  title[] =
          "<html>" CRLF
-        "<head><title>Index of "
+        "<head><meta name=\"viewport\" content=\"width=device-width, 
initial-scale=1.0\">" CRLF
+        "<title>Index of "
      ;

      static u_char  header[] =


More information about the nginx-devel mailing list