diff options
author | Peter Cai <[email protected]> | 2020-04-14 20:36:00 +0800 |
---|---|---|
committer | Peter Cai <[email protected]> | 2020-04-14 20:36:00 +0800 |
commit | 800a39956aef0feb995f74d3f3bd5cc2b7610650 (patch) | |
tree | 0f63cb1497b063b3e1bebab5f842372b56a92783 | |
parent | 62555714e6a4dd542fcb8e0b41094e0c4b5ee765 (diff) | |
download | paprika-800a39956aef0feb995f74d3f3bd5cc2b7610650.tar.gz |
render: add pathname to the page context
needed when we need to insert a comment system
-rw-r--r-- | src/render.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/render.rs b/src/render.rs index 2c6dc34..2386d40 100644 --- a/src/render.rs +++ b/src/render.rs @@ -64,6 +64,8 @@ struct PageContext { // (e.g. the workers.dev domain, which is differnent // from where you actually deploy the worker) base_url: String, + // The pathname part of the URL + pathname: String, // The current query string query: String } @@ -148,6 +150,7 @@ fn build_handlebars() -> Handlebars<'static> { fn build_page_context(url: &Url) -> PageContext { PageContext { base_url: url.origin(), + pathname: url.pathname(), query: url.search() } } |