Stenope icon indicating copy to clipboard operation
Stenope copied to clipboard

Load distant content

Open Miniplop opened this issue 9 months ago • 1 comments

Hello,

Nice work with this bundle, I really like the idea of generating static web pages with static content. I was wondering how to load content from distant HeadlessCMS. Should I write a custom provider + provider factory ? If yes, can you give an example, I'm struggling a bit to use them.

Miniplop avatar Apr 03 '25 17:04 Miniplop

Hi @Miniplop and thank you for your feedback :)

The bundle was designed and structured to be able to support different providers such as loading distant contents.

In theory, you'd "just" have to write a custom Provider implementing the ContentManagerInterface and fetching and listing contents through an HTTP call to your CMS.

Then a ProviderFactory implementing the ContentProviderFactoryInterface defining a new type of provider (e.g. "headless_cms") and making it available and configurable.

You can take the LocalFilesystemProvider and its LocalFilesystemProviderFactory as an exemple.

Then you'll be able to configure your project to use your headless CMS provider in the config like this:

stenope:
    providers:
        App\Model\Article:
            type: headless_cms
            api: https://my-headlead-cms.com/api
            token: 'my-token'

I'd be happy to review any attempt at implementation you're willing to try and offer help if you're stuck.

Tom32i avatar Apr 07 '25 16:04 Tom32i