Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

auto-generate a landing page if no index.html is found in a project root. #236

Open
Pomax opened this issue Oct 6, 2016 · 1 comment
Open

Comments

@Pomax
Copy link
Contributor

Pomax commented Oct 6, 2016

Filed as a duplicate of https://github.com/mozilla/thimble.mozilla.org/issues/1560, but then filed in the correct repo:

It would be very helpful for users if Thimble saved projects that do not have an index.html with an auto-generated index.html that gives users a hint on which URL they might want instead, such as a simple hyperlink list of .html files that do exist in the project (given that Thimble projects are remixable, exposing this information is in line with the fully open, remixable data concept Thimble is based around).

A basic flow:

  • user publishes project from client
  • *server receives publish instruction
  • server checks file layout for the to-publish information
  • if it does not see an index.html, it runs generateVirtualIndex() to generate an index.html file that is added to the "to-publish" set of files only (not the user's project)
  • server sends files off to AWS/S3/wherever

This generateVirtualIndex() would do something akin to:

  • grep the project filesystem for all .html files, ordered by nesting (root first, then depth-first)
  • template the result into a wrapper html snippet as <a href=...> elements so that users have a way to navigate to content
  • also offer a link to remix the project itself entirely
  • also offer text along the lines of "if this is your project and want people to see your main page rather than this disambiguation page, you will need to create an index.html for your project. You can do this by clicking ...blahblhablahblah" with some screenshots that illustrate how to add that index.html file.

Since this index.html file only exists at the time of publication in the absence of a user-defined index.html, the project files themselves are not affected, and loading up the project either for editing or remixing will not server up this file as suddenly having been generated into the project (rightly so. We should not be generating this file into the project, only into the file set pushed to S3).

Additionally, we can generate different landing pages based on the tool that's doing the publishing, although right now we only have two tools (goggles and thimble), one of which always generates an index.html so we could easily get away with a simple "just make one based on Thimble needs" until more consumer tools are added to this service.

@Pomax
Copy link
Contributor Author

Pomax commented Oct 6, 2016

/cc @humphd @gideonthomas

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant