cryogen-project / cryogen-core

Cryogen's core
Eclipse Public License 1.0
69 stars 62 forks source link

Bug: cannot set a page as homepage #135

Closed ir-regular closed 4 years ago

ir-regular commented 4 years ago

Attempted: adding a :home? true flag to a page.

Problem observed: page contents don't render.

Reproducible on a fresh cryogen install (screenshot attached.)

Cause:

  1. in params, :home-page may contain either a page or a post map.
  2. compile-index extracts :home-page and re-attaches it to params as both :post and :page, then passes the resulting map to render-file - see code.
  3. render-file calls htmlize-content
  4. in htmlize-content, cond short-circuits after finding :post and never htmlizes :page - see code
  5. back to compile-index - it selects the correct layout via (:layout home-page), and the layout attempts to print page.content, which has not been created in the previous step

Some options for a fix:

homepage-about
lacarmen commented 4 years ago

Thanks for the detailed report @ir-regular :)