Giter Site home page Giter Site logo

Copy htaccess files and other misc about sigal HOT 9 CLOSED

saimn avatar saimn commented on July 17, 2024
Copy htaccess files and other misc

from sigal.

Comments (9)

saimn avatar saimn commented on July 17, 2024

Good idea !

from sigal.

reagle avatar reagle commented on July 17, 2024

I'm thinking this should be in gallery.Gallery.build() ? Something like:

if self.settings['copy_htaccess']:
        if exists('.htaccess'):
            copy('.htaccess', self.settings['destination'])

from sigal.

saimn avatar saimn commented on July 17, 2024

I was thinking to something more generic, inspired by an old setting from pelican:

FILES_TO_COPY = (
        ('src/robots.txt', 'robots.txt'),
        ('src/images/favicon.ico','favicon.ico'),
        )

A list of tuples with the src and dest for each file to copy.

from sigal.

reagle avatar reagle commented on July 17, 2024

Sounds good! :)

from sigal.

reagle avatar reagle commented on July 17, 2024

I'm not sure how to specify this. Is it possible to have it copy any .htaccess file found in the source directories? I want it simply to copy some files found in the source directory to the output directory...? I fear I'd have to specify every file.

files_to_copy = (('hires/2014/.htacess', 'gallyer/2014/.htaccess'),
                ('hires/2013/.htacess', 'gallyer/2013/.htaccess'),
                ('hires/2012/.htacess', 'gallyer/2012/.htaccess'),
                ('hires/2011/.htacess', 'gallyer/2011/.htaccess'),
                ('hires/2010/.htacess', 'gallyer/2010/.htaccess'),
)

from sigal.

reagle avatar reagle commented on July 17, 2024

I've simplified my access controls so I can now make due with the specification below. I still think a list of files that are copied from all source directories is preferable, but this will do. Thank you for the feature!

files_to_copy = (
                ('_extras/htaccess-lock-index', '1972-1995/.htaccess'),
                ('_extras/htaccess-lock-index', '1996-1999/.htaccess'),
                ('_extras/htaccess-lock-index', '1999/.htaccess'),
                ('_extras/htaccess-lock-index', '2000/.htaccess'),
                ('_extras/htaccess-lock-index', '2001/.htaccess'),
                ('_extras/htaccess-lock-index', '2002/.htaccess'),
                ('_extras/htaccess-lock-index', '2003/.htaccess'),
                ('_extras/htaccess-lock-index', '2004/.htaccess'),
                ('_extras/htaccess-lock-index', '2005/.htaccess'),
                ('_extras/htaccess-lock-index', '2006/.htaccess'),
                ('_extras/htaccess-lock-index', '2007/.htaccess'),
                ('_extras/htaccess-lock-index', '2008/.htaccess'),
                ('_extras/htaccess-lock-index', '2009/.htaccess'),
                )

from sigal.

saimn avatar saimn commented on July 17, 2024

Hi Joseph,
Sorry for the lack of update, I was afk the last week-end. As the settings file is a python script you could use something like

files_to_copy = [('_extras/htaccess-lock-index', '{}/.htaccess'.format(dir)) for dir in os.listdir('_build')]

from sigal.

reagle avatar reagle commented on July 17, 2024

Huh, I'll think about that!

from sigal.

anarcat avatar anarcat commented on July 17, 2024

so once you'll have copied files in place, you'll notice that your gallery will prompt for passwords in sections even if they are not protected by .htaccess files. in case that's a problem for you, you may want to read up on the solution i found out in #220 (comment).

from sigal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.