Whether you need machine learning know-how, design to take your digital product to the next level, or strategy to set your roadmap, we can help. Book a free consult to learn more.
The biggest release so far, Beacon v0.4 adds some of the most requested features from our community to help create new sites, deploy multiple sites, and several other conveniences.
We invite everyone to give it a try, send suggestions, or report any bug you may find.
Please refer to the upgrade guide for the smoothest experience upgrading your application from Beacon v0.3.x.
User-defined JS Hooks
We’ve added initial support for JS hooks that can be added in the Admin interface at runtime. You just write the JS code and Beacon handles the rest - validating, bundling, and serving it for you.
Note that in this version it’s not yet possible to automatically import
libraries listed in your application package.json
.
For example, it’s not enough to simply run npm install cool-lib
and have it ready to use in your hook.
This workflow will likely be made possible in a future version, but an alternative for now is to load libraries from a CDN as https://unpkg.com
For example, let’s load Tippy.js and use in a JS hook. In a layout, add:
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
Then in the Admin interface create a hook named tippy
with this content:
export const tippy = {
mounted() {
window.tippy(this.el, {content: 'Start now'})
}
}
And finally edit a page to use that hook, for example in a button:
<button id="sign-up" phx-hook="tippy">Sign Up</button>
Multiple Hosts
Beacon has always supported various deployment strategies, including multiple hosts (domains) in the same application. However, such configuration was up to the user to implement, and that process was neither simple nor straightforward - it doesn’t work without many config changes and other details correctly in place.
For that reason, Beacon now accepts a --host
option for the beacon.gen.site task which will take care of all the setup for you, creating an Endpoint for each site and also a Proxy Endpoint responsible for routing the requests to each host/endpoint.
You can also use this option to upgrade existing sites! Beacon will automatically prepare the required changes to make it work.
Serve robots.txt and sitemap.xml Automatically
Two long-requested features, important for SEO, are now available: each Beacon site will automatically serve robots.txt and sitemap.xml files.
This also works if running multiple sites on the same host. The robots.txt file includes a Sitemap
field pointing to a sitemap_index.xml
(automatically generated by Beacon) which includes links to all running sites in the host.
Easier Install
Now you can install Beacon into existing applications with only 2 commands:
mix archive.install hex igniter_new
mix igniter.install beacon,beacon_live_admin --beacon.site my_site
Or start a new application with Beacon installed and hosted on a custom domain:
mix archive.install hex phx_new && mix archive.install hex igniter_new
mix igniter.new my_app --install beacon,beacon_live_admin --with phx.new --beacon.site my_site --beacon.host mysite.com
And More
Check out the Beacon changelog and Beacon LiveAdmin changelog for the complete list of changes.