Skip to content

Commit

Permalink
Update v0.3.0 guide
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Dec 5, 2024
1 parent a49895f commit 7de405d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions guides/upgrading/v0.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@

## Add `Beacon.Plug` to your Router

In your application's `router.ex`, first find the pipeline used for your beacon_site. It is usually `:browser` but you can check:
In your application's `router.ex` file, first find where your sites are defined:

```elixir
scope "/" do
scope "/", MyAppWeb do
pipe_through :browser
beacon_site "/", site: :my_site
end
```

In the above case we can see the pipeline is `:browser`. Still in the router, look for that pipeline and add `plug Beacon.Plug`:
In the above case we can see the site `:my_site` is inside a scope piped through `:browser`,
so let's add a new `:beacon` pipeline with the `Beacon.Plug`:

```elixir
pipeline :browser do
...
pipeline :beacon do
plug Beacon.Plug
end
```

Now the `Beacon.Plug` will ensure consistent rendering, particularly important when Page Variants are used.
And add that pipeline into the existing scope:

```elixir
scope "/", MyAppWeb do
pipe_through [:browser, :beacon] # <- add the pipeline here
beacon_site "/", site: :my_site
end
```

Now the `Beacon.Plug` will ensure consistent rendering, particularly important when Page Variants are used.

0 comments on commit 7de405d

Please sign in to comment.