Skip to content

Move minification into rendering and out of write_content (w/ patch) #3006

@EvanCarroll

Description

@EvanCarroll

Background, currently

  • write_content handles minification.
  • zola follows the pretty url pattern of generating foo/index.html for foo. So a file generated for /vcards/wikidata/Q136086504.vcf ends up creating /vcards/wikidata/Q136086504.vcf/index.html via write_content

At that that point that write_content is called it only knows the destination it's generating. It doesn't know anything about the input. So in the above example, it sees it is generating an index.html. This means something like .txt and ical generation is all a hack based on the above..

Ideally, the rendering step would handle minifcation, because it knows what template extension is being used. If the template is .html we know to minifiy.

Attached is a patch that proposes we change this, putting magnification into the rendering step. This isolates write_content the IO step.

I will supply a patch to handle this. This will allow you to generate anything with minifiy_html set to true, so long as the page's template is .txt or anything *ml. This may have even been the original design intent of the minification patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions