Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
368ba33
init docs
zcesur Apr 11, 2025
3584a53
add content
zcesur Apr 11, 2025
42288ea
update styling
zcesur Apr 11, 2025
f7b2130
update copy
zcesur Apr 11, 2025
99b44f7
add active tab indicator
zcesur Apr 11, 2025
25775ae
add mobile menu
zcesur Apr 11, 2025
ec2d982
updates
zcesur Apr 11, 2025
b53e286
add more content
zcesur Apr 11, 2025
4833421
add more content
zcesur Apr 11, 2025
f7c0bdb
add more
zcesur Apr 11, 2025
32f88f0
add more content
zcesur Apr 11, 2025
897f31e
add more content
zcesur Apr 11, 2025
1c2d728
updates
zcesur Apr 11, 2025
c0f8365
updates
zcesur Apr 11, 2025
3a19ab2
updates
zcesur Apr 11, 2025
5a4acda
Enhance canonical host handling in endpoint module to redirect reques…
zcesur Apr 12, 2025
a8f1f06
add /docs/contact
zcesur Apr 12, 2025
f0ad01d
update refs
zcesur Apr 12, 2025
ea41892
fix: properly handle canonical host redirection for docs
zcesur Apr 12, 2025
0675e0a
remove unused dep
zcesur Apr 12, 2025
b4690ea
fix strings
zcesur Apr 12, 2025
78de5c5
add slash commands doc
zcesur Apr 12, 2025
a9431ae
fmt
zcesur Apr 12, 2025
3afd76d
update path
zcesur Apr 12, 2025
b093464
add redirect for legacy path
zcesur Apr 12, 2025
a5f5ad3
add anchor on linked h2
zcesur Apr 12, 2025
2abb449
update img
zcesur Apr 12, 2025
a79a146
restyle sdk quickstarts
zcesur Apr 12, 2025
3f60bdd
drop ~p's in doc links
zcesur Apr 12, 2025
f8a9a30
fix light mode issues
zcesur Apr 12, 2025
5eeb737
fix light mode issues
zcesur Apr 12, 2025
8a2ae37
remove footer max width
zcesur Apr 12, 2025
0a5556f
update obsolete links
zcesur Apr 12, 2025
c04d2d9
misc
zcesur Apr 12, 2025
fac00d3
add shields doc
zcesur Apr 12, 2025
e02c332
add socials doc
zcesur Apr 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
"../lib/*_web.ex",
"../lib/*_web/**/*.*ex",
"./svelte/**/*.svelte",
"../priv/content/**/*.md",
],
theme: {
container: {
Expand Down
1 change: 1 addition & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ config :algora,
redirects: [
{"/tv", "https://tv.algora.io"},
{"/discord", "https://discord.gg/9RXD2nqbnG"},
{"/docs/bounties/payments", "/docs/payments"},
{"/sdk", "https://github.com/algora-io/sdk"},
{"/healthcare", "https://blog.algora.io/post/healthcare"},
{"/podcast", "https://www.youtube.com/@algora-io/podcasts"},
Expand Down
2 changes: 1 addition & 1 deletion lib/algora/bot_templates/bot_templates.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Algora.BotTemplates do
### Steps to solve:
1. **Start working**: Comment `/attempt #${ISSUE_NUMBER}` with your implementation plan
2. **Submit work**: Create a pull request including `/claim #${ISSUE_NUMBER}` in the PR body to claim the bounty
3. **Receive payment**: 100% of the bounty is received 2-5 days post-reward. [Make sure you are eligible for payouts](https://docs.algora.io/bounties/payments#supported-countries-regions)
3. **Receive payment**: 100% of the bounty is received 2-5 days post-reward. [Make sure you are eligible for payouts](https://algora.io/docs/payments#supported-countries-regions)

Thank you for contributing to ${REPO_FULL_NAME}!
${ATTEMPTS}
Expand Down
53 changes: 52 additions & 1 deletion lib/algora/content.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Algora.Content do

alias Algora.Markdown

defstruct [:slug, :title, :date, :tags, :authors, :content]
defstruct [:slug, :title, :date, :tags, :authors, :content, :path]

defp base_path, do: Path.join([:code.priv_dir(:algora), "content"])

Expand Down Expand Up @@ -38,6 +38,57 @@ defmodule Algora.Content do
|> Enum.sort_by(& &1.date, :desc)
end

def list_content_rec(directory) do
list_content_rec_helper([base_path(), directory], directory)
end

defp list_content_rec_helper(path, root_dir) do
case File.ls(Path.join(path)) do
{:ok, entries} ->
entries
|> Enum.reduce(%{files: [], dirs: %{}}, fn entry, acc ->
full_path = Path.join(path ++ [entry])

cond do
File.dir?(full_path) ->
nested_content = list_content_rec_helper(path ++ [entry], root_dir)
put_in(acc, [:dirs, entry], nested_content)

String.ends_with?(entry, ".md") ->
# Get the path relative to base_path
relative_path =
full_path
|> Path.relative_to(base_path())
|> Path.rootname(".md")

path_segments =
relative_path
|> Path.split()
|> Enum.drop(1)

directory = Path.dirname(relative_path)
slug = Path.basename(relative_path)

case load_content(directory, slug) do
{:ok, content} ->
content_with_path = Map.put(content, :path, path_segments)
Map.update!(acc, :files, &[content_with_path | &1])

_ ->
acc
end

true ->
acc
end
end)
|> Map.update!(:files, &Enum.sort_by(&1, fn file -> file.date end, :desc))

{:error, _} ->
%{files: [], dirs: %{}}
end
end

def format_date(date_string) when is_binary(date_string) do
case Date.from_iso8601(date_string) do
{:ok, date} -> Calendar.strftime(date, "%B %d, %Y")
Expand Down
6 changes: 3 additions & 3 deletions lib/algora_web/constants.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ defmodule AlgoraWeb.Constants do
calendar_url: "https://cal.com/ioannisflo",
github_repo_url: "https://github.com/algora-io/console",
github_repo_api_url: "https://api.github.com/repos/algora-io/console",
docs_url: "https://docs.algora.io",
docs_supported_countries_url: "https://docs.algora.io/bounties/payments#supported-countries-regions",
docs_url: ~p"/docs",
docs_supported_countries_url: ~p"/docs/payments",
demo_url: "https://www.youtube.com/watch?v=Ts5GhlEROrs",
sdk_url: ~p"/sdk",
privacy_url: ~p"/legal/privacy",
terms_url: ~p"/legal/terms",
blog_url: "https://blog.algora.io",
contact_url: "https://docs.algora.io/contact",
contact_url: ~p"/docs/contact",
algora_tv_url: "https://algora.tv",
tel_formatted: "+1 (650) 420-2207",
tel: "+16504202207"
Expand Down
13 changes: 10 additions & 3 deletions lib/algora_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ defmodule AlgoraWeb.Endpoint do
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.
alias AlgoraWeb.Plugs.CanonicalHostPlug

@session_options [
store: :cookie,
key: "_algora_key",
Expand Down Expand Up @@ -60,13 +62,18 @@ defmodule AlgoraWeb.Endpoint do
# Legacy tRPC endpoint
defp canonical_host(%{path_info: ["api", "trpc" | _]} = conn, _opts), do: conn

defp canonical_host(conn, _opts) do
defp canonical_host(%{host: "docs.algora.io"} = conn, _opts),
do: redirect_to_canonical_host(conn, Path.join(["/docs", conn.request_path]))

defp canonical_host(conn, _opts), do: redirect_to_canonical_host(conn, conn.request_path)

defp redirect_to_canonical_host(conn, path) do
:algora
|> Application.get_env(:canonical_host)
|> case do
host when is_binary(host) ->
opts = PlugCanonicalHost.init(canonical_host: host)
PlugCanonicalHost.call(conn, opts)
opts = CanonicalHostPlug.init(canonical_host: host, path: path)
CanonicalHostPlug.call(conn, opts)

_ ->
conn
Expand Down
Loading