aperezdc / ngx-fancyindex

Fancy indexes module for the Nginx web server
Other
849 stars 128 forks source link

fancyindex_css_href is not working #106

Closed SubrataM3 closed 2 years ago

SubrataM3 commented 5 years ago

Hi, I am unable to get fancyindex_css_href working. header.html and footer.html is working correctly. If i put wrong path on "fancyindex_header" directive then nginx triggers error. but making changes to fancyindex_css_href's path does not affect anything.

location ^~ /publicdata/simple/ {
    fancyindex on;              # Enable fancy indexes.
    fancyindex_exact_size off;  # Output human-readable file sizes.
    fancyindex_css_href "/apaxy/theme/style.css";
    fancyindex_header "/apaxy/theme/header.html";
    fancyindex_footer "/apaxy/theme/footer.html";
    fancyindex_ignore .htaccess favicon.ico /theme;
}

What I am doing wrong? Thanks.

ryandesign commented 2 years ago

That's correct. The string you specify in fancyindex_css_href is inserted into a <link> tag within the <head> section of the standard header. If you are using your own header by setting fancyindex_header, fancyindex_css_href does nothing, and you don't need it: just write your own <link> tag in your header.html file.

aperezdc commented 2 years ago

The explication given by @ryandesign is correct (thanks!) so I think we can consider this case closed.

@SubrataM3 Of course feel free to reopen if you have further issues in this regard.

ryandesign commented 2 years ago

There is a slight inconsistency in fancyindex: Some settings like fancyindex_css_href are allowed to be set even if they do nothing. This makes sense to me but can cause some user confusion as it did in this issue. On the other hand, some other settings do not permit this ("FancyIndex : cannot set show_path to off without providing a custom header !").

Personally I found it slightly annoying that I could not even start nginx when I had set fancyindex_show_path off without setting a custom header. In truth, I had been testing out various configurations, and had just commented out the custom header; it was a small inconvenience to also have to comment out fancyindex_show_path off. It would have sufficed to me to have a warning printed in the log that setting fancyindex_show_path off does nothing without a custom header. The same could be done if fancyindex_css_href is set without a custom header.