Skip to content

Commit bf061e6

Browse files
author
Morgan Haskel
committed
Merge pull request #1124 from genebean/IndexStyleSheet_Support
Added the ability to define the IndexStyleSheet setting for a directory
2 parents 223b18b + 53a0d73 commit bf061e6

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,9 +1944,10 @@ Allows configuration settings for [directory indexing](http://httpd.apache.org/d
19441944
apache::vhost { 'sample.example.net':
19451945
docroot => '/path/to/directory',
19461946
directories => [
1947-
{ path => '/path/to/directory',
1948-
options => ['Indexes','FollowSymLinks','MultiViews'],
1949-
index_options => ['IgnoreCase', 'FancyIndexing', 'FoldersFirst', 'NameWidth=*', 'DescriptionWidth=*', 'SuppressHTMLPreamble'],
1947+
{ path => '/path/to/directory',
1948+
directoryindex => 'disabled', # this is needed on Apache 2.4 or mod_autoindex doesn't work
1949+
options => ['Indexes','FollowSymLinks','MultiViews'],
1950+
index_options => ['IgnoreCase', 'FancyIndexing', 'FoldersFirst', 'NameWidth=*', 'DescriptionWidth=*', 'SuppressHTMLPreamble'],
19501951
},
19511952
],
19521953
}
@@ -1968,6 +1969,23 @@ Sets the [default ordering](http://httpd.apache.org/docs/current/mod/mod_autoind
19681969
}
19691970
```
19701971

1972+
######`index_style_sheet`
1973+
1974+
Sets the [IndexStyleSheet](http://httpd.apache.org/docs/current/mod/mod_autoindex.html#indexstylesheet) which adds a CSS stylesheet to the directory index.
1975+
1976+
```puppet
1977+
apache::vhost { 'sample.example.net':
1978+
docroot => '/path/to/directory',
1979+
directories => [
1980+
{ path => '/path/to/directory',
1981+
options => ['Indexes','FollowSymLinks','MultiViews'],
1982+
index_options => ['FancyIndexing'],
1983+
index_style_sheet => '/styles/style.css',
1984+
},
1985+
],
1986+
}
1987+
```
1988+
19711989
######`options`
19721990

19731991
Lists the [Options](http://httpd.apache.org/docs/current/mod/core.html#options) for the given Directory block.

spec/defines/vhost_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@
183183
'provider' => 'files',
184184
'require' => 'all granted',
185185
},
186+
{ 'path' => '/var/www/files/indexed_directory',
187+
'directoryindex' => 'disabled',
188+
'options' => ['Indexes','FollowSymLinks','MultiViews'],
189+
'index_options' => ['FancyIndexing'],
190+
'index_style_sheet' => '/styles/style.css',
191+
},
186192
],
187193
'error_log' => false,
188194
'error_log_file' => 'httpd_error_log',
@@ -360,6 +366,14 @@
360366
:content => /^\s+Require all denied$/ ) }
361367
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
362368
:content => /^\s+Require all granted$/ ) }
369+
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
370+
:content => /^\s+Options\sIndexes\sFollowSymLinks\sMultiViews$/ ) }
371+
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
372+
:content => /^\s+IndexOptions\sFancyIndexing$/ ) }
373+
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
374+
:content => /^\s+IndexStyleSheet\s'\/styles\/style\.css'$/ ) }
375+
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
376+
:content => /^\s+DirectoryIndex\sdisabled$/ ) }
363377
it { is_expected.to contain_concat__fragment('rspec.example.com-additional_includes') }
364378
it { is_expected.to contain_concat__fragment('rspec.example.com-logging') }
365379
it { is_expected.to contain_concat__fragment('rspec.example.com-serversignature') }

templates/vhost/_directories.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
<%- end -%>
4747
<%- if directory['index_order_default'] -%>
4848
IndexOrderDefault <%= Array(directory['index_order_default']).join(' ') %>
49+
<%- end -%>
50+
<%- if directory['index_style_sheet'] -%>
51+
IndexStyleSheet '<%= directory['index_style_sheet'] %>'
4952
<%- end -%>
5053
<%- if directory['allow_override'] -%>
5154
AllowOverride <%= Array(directory['allow_override']).join(' ') %>

0 commit comments

Comments
 (0)