-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: basepath routing for DevServer vhost emulation #59
Changes from 7 commits
6ac028b
ff0fc09
36990fd
fdf49ca
7e83c6d
a51fa07
588fc78
d79cccb
a97653b
d2d8b79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ defmodule Tableau do | |||||
|
||||||
* `:include_dir` - string - Directory that is just copied to the output directory. Defaults to `extra`. | ||||||
* `:timezone` - string - Timezone to use when parsing date times. Defaults to `Etc/UTC`. | ||||||
* `:base_path - string - base path to use with Github Pages or web-servers that use a location prefix for Vhosts | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||
* `:url` - string (required) - The URL of your website. | ||||||
* `:markdown` - keyword | ||||||
* `:mdex` - keyword - Options to pass to `MDEx.to_html/2` | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ defmodule Tableau.Config do | |
|
||
defstruct [ | ||
:url, | ||
base_path: "", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add documentation for this. Its in the Tableau moduledoc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
include_dir: "extra", | ||
timezone: "Etc/UTC", | ||
reload_log: false, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ defmodule Tableau.Router do | |
|
||
require Logger | ||
|
||
@base_path Path.join("/", Application.compile_env(:tableau, :config)[:base_path] || "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you actually need the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my testing it defaults to nil, which causes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, sorry, I was thinking of the default coming from the struct. This is fine then, should also add to the other spot instead of that case expression There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took a closer look at this. Turns out there is a small difference in the arguments accepted by |
||
|
||
@not_found ~g''' | ||
<!DOCTYPE html><html lang="en"><head></head><body>Not Found</body></html> | ||
'''html | ||
|
@@ -14,7 +16,7 @@ defmodule Tableau.Router do | |
plug :rerender | ||
|
||
plug Tableau.IndexHtml | ||
plug Plug.Static, at: "/", from: "_site", cache_control_for_etags: "no-cache" | ||
plug Plug.Static, at: @base_path, from: "_site", cache_control_for_etags: "no-cache" | ||
|
||
plug :match | ||
plug :dispatch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done