Skip to content

Commit

Permalink
chore: fix redirecting to hexdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jan 23, 2025
1 parent 6742481 commit 99d7300
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
7 changes: 6 additions & 1 deletion lib/ash_hq_web/redirect_to_hex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ defmodule AshHqWeb.RedirectToHex do
def init(opts), do: opts

def call(conn, _) do
IO.inspect(conn.params)

case conn.params do
%{"dsl_target" => dsl_target} ->
to_load = AshHq.Docs.Extensions.Search.load_for_search(AshHq.Docs.Module)
Expand Down Expand Up @@ -80,9 +82,12 @@ defmodule AshHqWeb.RedirectToHex do
end

%{"guide" => path, "library" => library} ->
IO.inspect("HERE")
redirect_to_hex(conn, "https://hexdocs.pm/#{library}/#{List.last(path)}.html")

_ ->
stuff ->
IO.inspect(stuff)

conn
end
end
Expand Down
17 changes: 9 additions & 8 deletions lib/ash_hq_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ defmodule AshHqWeb.Router do
live("/blog", AppViewLive, :blog)
live("/blog/:slug", AppViewLive, :blog)
# live("/community", AppViewLive, :community)
# live("/docs/", AppViewLive, :docs_dsl)
# live("/docs/guides/:library/:version/*guide", AppViewLive, :docs_dsl)
# live("/docs/dsl/:dsl_target", AppViewLive, :docs_dsl)
# live("/docs/dsl/:library/:version", AppViewLive, :docs_dsl)
# live("/docs/dsl/:library/:version/:extension", AppViewLive, :docs_dsl)
# live("/docs/module/:library/:version/:module", AppViewLive, :docs_dsl)
# live("/docs/mix_task/:library/:version/:mix_task", AppViewLive, :docs_dsl)
# live("/docs/:library/:version", AppViewLive, :docs_dsl)
get "/docs/", HomeController, :home
get "/docs/guides/:library/:version/*guide", HomeController, :home
get "/docs/dsl/:dsl_target", HomeController, :home
get "/docs/dsl/:library/:version", HomeController, :home
get "/docs/dsl/:library/:version/:extension", HomeController, :home
get "/docs/module/:library/:version/:module", HomeController, :home
get "/docs/mix_task/:library/:version/:mix_task", HomeController, :home
get "/docs/:library/:version", HomeController, :home
get "/docs/*path", HomeController, :home

# for showing deprecated forum content
live("/forum", AppViewLive, :forum)
Expand Down

0 comments on commit 99d7300

Please sign in to comment.