diff --git a/README.md b/README.md index 4f7a4816a..24199700c 100644 --- a/README.md +++ b/README.md @@ -19,29 +19,13 @@ To build the site locally: You could do it in release mode if you'd like, but it's pretty fast in debug. -From there, the generated HTML will be in a `site` directory. You can use -any web server to check it out in your browser: +From there, the generated HTML will be in a `site` directory. +Open `site/index.html` in your web browser to view the site. ```console -> cd site -> python3 -m http.server +> firefox site/index.html ``` -The site is now available at . - -If you need to preview the site from another machine, pass the host's address via `--bind`. For example, if running on 192.168.72.73: - -```console -> cd site -> python3 -m http.server --bind 192.168.72.73 -``` - -The site is now available at . - -(As a short-cut: If you pass `--bind 0.0.0.0`, the server will be reachable at [all of the host's IP addresses][].) - -[all of the host's IP addresses]: https://www.howtogeek.com/225487/what-is-the-difference-between-127.0.0.1-and-0.0.0.0/ - ## Contributing First of all, thank you! diff --git a/src/blogs.rs b/src/blogs.rs index aa350866e..d7b671605 100644 --- a/src/blogs.rs +++ b/src/blogs.rs @@ -111,6 +111,10 @@ impl Blog { &self.prefix } + pub(crate) fn path_back_to_root(&self) -> PathBuf { + self.prefix.components().map(|_| Path::new("../")).collect() + } + pub(crate) fn posts(&self) -> &[Post] { &self.posts } diff --git a/src/main.rs b/src/main.rs index f5e89a2c9..08842086f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -120,7 +120,7 @@ impl<'a> Generator<'a> { .map(|other_blog| { json!({ "link_text": other_blog.link_text(), - "url": PathBuf::from("/").join(other_blog.prefix()).join("index.html"), + "url": other_blog.prefix().join("index.html"), }) }) .collect(); @@ -130,6 +130,7 @@ impl<'a> Generator<'a> { "parent": "layout", "blog": blog, "other_blogs": other_blogs, + "root": blog.path_back_to_root(), }); self.render_template(blog.prefix().join("index.html"), "index", data)?; Ok(()) @@ -152,6 +153,7 @@ impl<'a> Generator<'a> { "parent": "layout", "blog": blog, "post": post, + "root": blog.path_back_to_root().join("../../../"), }); self.render_template(path.join(filename), &post.layout, data)?; diff --git a/src/styles/fonts.scss b/src/styles/fonts.scss index 7e4c4cf41..4489cc84f 100644 --- a/src/styles/fonts.scss +++ b/src/styles/fonts.scss @@ -70,7 +70,7 @@ $format-names: ( @function urls($filename, $range, $extensions) { $urls: (); @each $extension in $extensions { - $url: url('/fonts/#{$extension}/#{$filename}.#{$range}.#{$extension}'); + $url: url('../fonts/#{$extension}/#{$filename}.#{$range}.#{$extension}'); $format: format(map-get($format-names, $extension)); $urls: append($urls, $url $format, comma); diff --git a/templates/footer.hbs b/templates/footer.hbs index 9b3535b62..10340a005 100644 --- a/templates/footer.hbs +++ b/templates/footer.hbs @@ -22,15 +22,15 @@

Social

- twitter logo - youtube logo - discord logo - github logo + twitter logo + youtube logo + discord logo + github logo

RSS

@@ -43,4 +43,4 @@ - + diff --git a/templates/headers.hbs b/templates/headers.hbs index bdc90040c..3e19aa182 100644 --- a/templates/headers.hbs +++ b/templates/headers.hbs @@ -14,18 +14,18 @@ - - - - + + + + - - - - - - + + + + + + diff --git a/templates/index.hbs b/templates/index.hbs index f0574185f..3ebc8c39b 100644 --- a/templates/index.hbs +++ b/templates/index.hbs @@ -10,7 +10,7 @@

See also: {{#each other_blogs}} - {{link_text}} + {{link_text}} {{/each}}

@@ -28,7 +28,7 @@ {{/if}} {{month_name month}} {{day}} - {{title}} + {{title}} {{/each}} diff --git a/templates/nav.hbs b/templates/nav.hbs index 8b60ae001..d63976122 100644 --- a/templates/nav.hbs +++ b/templates/nav.hbs @@ -1,7 +1,7 @@