56422

Is there an efficient way in docpad to keep static and to-be-rendered files in the same directory?

I am rebuilding a site with docpad and it's very liberating to form a folders structure that makes sense with my workflow of content-creation, but I'm running into a problem with docpad's hard-division of content-to-be-rendered vs 'static'-content.

Docpad recommends that you put things like images in /files instead of /documents, and the documentation makes it sound as if otherwise there will be some processing overhead incurred.

    <li>

    First, I'd like an explanation if anyone has it of why a file with a single extension (therefore no rendering) and no YAML front-matter, such as a .jpg, would impact site-regeneration time when placed within /documents.

    </li> <li>

    Second, the real issue: is there a way, if it does indeed create a performance hit, to mitigate it? For example, to specify an 'ignore' list with regex, etc...

    </li> </ul>

    My use case

    I would like to do this for posts and their associated images to make authoring a post more natural. I can easily see the images I have to work with and all the related files are in one place.

    I also am doing this for an artwork I am displaying. In this case it's an even stronger use case, as the only data in my html.eco file is yaml front matter of various meta data, my layout automatically generates the gallery from all the attached images located in a folder of the same-name as the post. I can match the relative output path folder in my /files directory but it's error prone, because you're in one folder (src/files/artworks/) when creating the folder of images and another (src/documents/artworks/) when creating the html file -- typos are far more likely (as you can't ever see the folder and the html file side by side)...

    <strong>Even without justifying a use case</strong> I can't see why docpad should be putting forth such a hard division. A performance consideration should not be passed on to the end user like that if it can be avoided in any way; since with docpad I am likely to be managing my blog through the file system I ought to have full control over that structure and certainly don't want my content divided up based on some framework limitation or performance concern instead of based on logical content divisions.

    Answer1:

    I think the key is the line about "metadata".Even though a file does NOT have a double extension, it can still have metadata at the top of the file which needs to be scanned and read. The double extension really just tells docpad to convert the file from one format and output it as another. If I create a straight html file in the document folder I can still include the metadata header in the form:

    --- tags: ['tag1','tag2','tag3'] title: 'Some title' ---

    When the file is copied to the out directory, this metadata will be removed. If I do the same thing to a html file in the files directory, the file will be copied to the out directory with the metadata header intact. So, the answer to your question is that even though your file has a single extension and is not "rendered" as such, it still needs to be opened and processed.

    The point you make, however, is a good one. Keeping images and documents together. I can see a good argument for excluding certain file extensions (like image files) from being processed. Or perhaps, only including certain file extensions.

Recommend

  • How to chain Optional#ifPresent() in lambda without nesting?
  • Methods to reduce apparent lag to client from large javascript operations
  • PHP Out of Memory Exception
  • Using a fragment as a Thymeleaf variable to th:with and a th:data-content attribute
  • ROWDEPENDENCIES Overhead in Oracle
  • Mouse press slot for QComboBox - fill the items dynamically if user clicks the combobox
  • Icon's priority on action bar (keeping order of items)
  • Is it advisable to use print statements in a python function rather than return
  • Do nested blocks have any performance impact in PL/SQL procedures?
  • 2 instances of Sonar on same machine
  • what happens to the exisiting users after unpublish of google-chrome-extension
  • Avoid N+1 Select with list of NHibernate entities
  • Scaling Azure cloud services geographically across multiple data centers [closed]
  • Does Angular 2 application block cookies from being stored by default?
  • Automatically Replace Misspellings with Suggestions for long lists of terms
  • Play WS API: throttling request rates
  • C++ exception safety paranoia: how much is too much?
  • C++ std::set comparator
  • Prolog Query - Trying to understand how this result happens
  • Fluid video height
  • Weird LEFT OUTER JOIN on Includes eager loading of rails 3
  • Does the failbit effect the call ignore on cin?
  • Buffer a large file; BufferedInputStream limited to 2gb; Arrays limited to 2^31 bytes
  • How many Vertica Databases can run on a Host in the same time?
  • How do you keep a running instance for Google App Engine
  • WordPress > setting permalink option via script buggy?
  • MySQL performance when updating row with FK
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • Webgrid not refreshing after delete MVC
  • Extracting HTML between tags
  • MongoDB in PHP using aggregate to group by _id is null not working
  • Debugging ASP.NET on a built-in web server suddenly stops
  • Regex thinks I'm nesting, but I'm not
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • Add sale price programmatically to product variations
  • Unable to use reactive element in my shiny app
  • How do I use LINQ to get all the Items that have a particular SubItem?