Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

handles understood index.html for subdirectories #4

Merged
merged 1 commit into from

4 participants

@potench

The original code renders the template /index.html to the route / after finding "index" in the page.output string.

The updated code adds the correct subdirectory so all index.html will route to the correct subdirectory (ex: /teams/index.html routes to /teams/ when running statix:server).

@landongn

+1 please have my children

@gigafied

Yeah this is good. Been meaning to do this for ages.

@potench potench merged commit 6cfbc0f into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 15, 2013
  1. @potench
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 bin/statix-cli.js
View
5 bin/statix-cli.js
@@ -126,12 +126,13 @@ function start_server (settingsFile, port) {
}
}
- var page, i;
+ var page, i, subdir;
for (i = 0; i < settings.pages.length; i ++) {
page = settings.pages[i];
if (!indexFound && page.source.indexOf("index") > -1 || page.output.indexOf("index") > -1) {
- app.get("/", renderTemplate(page));
+ subdir = "/" + page.output.substr(0, page.output.indexOf("index"));
+ app.get(subdir, renderTemplate(page));
indexFound = true;
}
app.get("/" + page.output, renderTemplate(page));
Something went wrong with that request. Please try again.