breadsystems / bread-cms

A powerful, opinionated Clojure/Script library for building custom Content Management Systems
Eclipse Public License 1.0
18 stars 2 forks source link

:thing/children abstract attribute #91

Closed acobster closed 3 months ago

acobster commented 8 months ago

No more :post/children, :taxon/children, etc. It shouldn't matter what "type" it is. What we're interested in is:

  1. whether the thing has children
  2. whether the thing has a parent
  3. whether we need to worry about ancestry when building a URL

If a thing has a :thing/_children attribute, we know it is the child of something. In combination with a slug abstraction, this can help us build URIs from route definitions in an abstract way, without caring about whether the thing is a post, taxon, menu item, etc.

(def route
  ["/{field/lang}/page/{entity/slug*}"
   {:name :page
    :route/parsed [:field/lang "page" {:attr :thing/slug
                                       :spec '{:thing/_children [:thing/slug {:thing/_children ...}}]}]}])