Enabling/attaching and disabling/detaching content providers from Episerver edit UI

How and why you should register content providers from the UI.

Published 15th of december 2018
Episerver > 8

Content Providers in Episerver is a way of publishing external data as pages/blocks etc… but also a way of publishing content in several places on your web/sites. Due to the lack of publishing in several containers/parents, this is a way of cloning data and keeping friendly urls. For example list news or job posts in a multisite environment.

More about coding a provider: https://devblog.gosso.se/2016/09/contentprovider-example-for-episerver-former-pageprovider/

Registering a provider in webconfig / episerver looks like this

However, this is kind of static, and the downside is that that entrypoint nod/page is disabled for edit.

And sometimes you need to change settings on that page so a better approach would be NOT to register the content provider thru the web.config.

Best practice registering a content provider

First of all, i’ve made a base class for all my startpages (multi site or single site scenario)

Use a onPublishing event to handle changes “ReloadProvider”

Then i have a helper class to manage the load/reload/remove providers

Last, Register from code OnInit

SEO terms

  • Attaching ContentProviders programmatically
  • Reset content providers runtime
  • programmatically add content provider

About the author

Luc Gosso
– Independent Senior Web Developer
working with Azure and Episerver

Twitter: @LucGosso
LinkedIn: linkedin.com/in/luc-gosso/
Github: github.com/lucgosso

Like it? please up vote
1