From 99d7300812d7f3078d6388523e64312eb9702fd6 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Thu, 23 Jan 2025 07:47:38 -0500 Subject: [PATCH] chore: fix redirecting to hexdocs --- lib/ash_hq_web/redirect_to_hex.ex | 7 ++++++- lib/ash_hq_web/router.ex | 17 +++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/ash_hq_web/redirect_to_hex.ex b/lib/ash_hq_web/redirect_to_hex.ex index ba866d7..717c555 100644 --- a/lib/ash_hq_web/redirect_to_hex.ex +++ b/lib/ash_hq_web/redirect_to_hex.ex @@ -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) @@ -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 diff --git a/lib/ash_hq_web/router.ex b/lib/ash_hq_web/router.ex index 3b7bb78..8667179 100644 --- a/lib/ash_hq_web/router.ex +++ b/lib/ash_hq_web/router.ex @@ -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)