-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Labels
Description
Allow users to pack config, functions, and data to extend Beacon.
Enable plugins in your site config:
plugins: [MyBlogPlugin]And the plugin implements Beacon.Plugin:
defmodule MyBlogPlugin do
@behaviour Beacon.Plugin
@impl true
def config do
%Beacon.Config{
extra_page_fields: [MyBlogPlugin.PageFields.Type]
# ... and more if needed
}
end
@impl true
def install(opts) do
# install script to seed data / bootstrap content like components
# eg: insert components
end
# provide extra functions to be used on sites
def latest_blog_posts(limit) do
Beacon.Content.list_published_pages(...)
end
end
defmodule MyBlogPlugin.PageFields.Type do
@behaviour Beacon.Content.PageField
# ... omitted
end- With this approach we can extend Beacon as necessary by adding new callbacks to inject code into different levels of its lifecycle.
- Config can only be merged, ie: can't remove values.
Reactions are currently unavailable