This forum has moved, please join us on github discussions. We will keep these old posts available for reference. Thank you!

How do I use Apostrophe in a headless fashion?

I have an existing web application. I would like to use Apostrophe to integrate static content into the site.

My tentative plan:

  • Existing angular application will run through its normal router
  • If there’s no angular-defined route, make an API call to see if there’s an apostrophe page. If so, return the HTML and dump it into a <div>.
  • Host the actual apostrophe editor on a separate domain

Is this sane? How do I go about getting the HTML content of a page into angular?

You could use Apostrophe in this way.

The simplest way: If you add ?xhr=1 to any page URL, Apostrophe does not render the outer layout.

In addition you can look at data.query in your page templates and/or layout template and use that to decide what to render.