Bertrand Le Roy's blog
No web site should be a silo. A CMS should be great at organizing, syndicating, and presenting your content, but it should also communicate with arbitrary applications outside the CMS. In particular, mobile applications should be able to use the data from the CMS. In DecentCMS, you can enable the
content-apifeature to expose all content items as JSON documents.
Content items are then available under two endpoints:
In the previous two posts, I exposed the general design of DecentCMS’ search feature, and described its indexing and querying APIs. In this post, we’ll apply what we’ve learned to build a paginated list of search results that will display the list of API documentation topics.
In the previous post, we looked at the basic concepts DecentCMS querying are built upon, and at how an index is built. In this post, we’ll examine how to query such an index in order to produce a result set.
Great libraries don’t just package useful functionality in a re-usable package, they do so while reducing friction. Low friction means that the answer to “hey, wouldn’t it be great if you could just do X?”, is “yes, it would, and you can.” Doing something simple is never complicated, and the way to do it is easily found, if not plainly obvious. Using such libraries is a joy, never a struggle. Of course, getting results like those is far from being easy, and requires smart designs and clean implementations. Most of all, it requires the library author to put himself in the shoes of his users.
An order for an electric conversion of a vintage Porsche just arrived at Greg’s workshop. He follows a script that will implement the transformation of the car. He looks at the order, and sees that the customer bought the 70kWh battery. He picks up the right number of cells, and re-orders more to refill the stock. The batteries are secured in the trunk. Then, he removes the car’s engine, and disposes of it. He fits the electric motor in its place, and proceeds to route wires from the trunk to the engine’s compartment. The control system is then assembled. All these operations are done sequentially by Greg. In a few weeks, the car is ready.
Meanwhile, a few kilometers away, another order for a brand new electric car arrives at Elon’s factory. It should be an obsidian black metallic all-wheel drive with a 85kWh battery, panoramic roof, silver cyclone wheels, black leather seats, carbon fiber décor, black alcantara headliner, autopilot, and subzero weather package. That’s a lot of little independent details.
This morning, Microsoft made a surprise announcement (or two): a new cross-platform code editor named Visual Studio Code. It runs on Mac, Linux, and of course Windows. It’s lean, fast, it has IntelliSense, supports multiple languages and dev platforms, has debugging and git built-in. You can get it from the following link:
Documentation is considered a feature in DecentCMS, and as such, it is expected that all modules come with tests, API documentation, and documentation topics. Documentation, like tests, are part of the same code repository as the rest of the application or module.
The widgets layer file can be found under
index.jsonfile describes the layers of widgets for the site. Layers are collections of widgets that can be turned on or off by an expression that is associated with each layer and that gets evaluated for each request against an environment that can be contributed to by modules, and that can use extension rules also contributed by modules. More than one layer can be active on any given page of the site.
Placement files describe how to dispatch shapes into zones. They are necessary in order to decouple UI composition from individual templates. Templates can focus on what to render, while placement determine what to render where. In yesterday’s post, I’ve shown one rudimentary example of placement. There can be a placement file at the root of each module and theme. A placement file can either be a
placement.jsonfile, or a
placement.jsfile if the format for JSON placement files is not sufficiently flexible for the problem at hand.
Placement works in a relative manner: more than one content item can appear on any given page, for example through lists of content items, or as widgets. Placement can dispatch the shapes created by the parts of a content item into the local zones under a given root shape that is usually the main shape for the content item.