Skip to content

Commit e3e77e0

Browse files
Merge pull request #331 from jekyll/docs
Document #320
2 parents 66ee967 + b7c14c9 commit e3e77e0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/architecture.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ description: Jekyll Admin exists in two parts, a Ruby back end and a Javascript
88

99
Jekyll Admin piggybacks on Jekyll's built-in Webrick server. We monkey patch the `jekyll serve` command to hook in two Sinatra servers, one to serve the static front end that lives in `lib/jekyll-admin/public/dist` via `/admin`, and one to serve the Ruby API via `/_api`. Once the Sinatra servers are mounted, they work just like any other Jekyll server (and we rely on third-party plugins like `sintra-json` and `sinatra-cross_origin`).
1010

11+
**Note:** Since there are two Sinatra servers that might call `site.process` concurrently, Jekyll Admin disables `--watch` and `--detach` flags to prevent a race condition between these servers that might cause incorrect responses for the API. This ensures that the site is regenerated by only the process that Jekyll Admin runs.
12+
1113
## How Jekyll Admin formats Jekyll objects for the API
1214

1315
Whenever possible, we want to stay as close to the `to_liquid.to_json` representation of Jekyll's internal object structure as possible, so that we're (A) using data structure that developers are used to, and (B) so that we can benefit from upstream improvements. To do this, we have the `JekyllAdmin::APIable` module, which gets included in native Jekyll objects like Pages and Documents to add a `to_api` method which we can call to generate hashes for use in the API.

0 commit comments

Comments
 (0)