Permalink
Browse files

Don't put unnecessary index.html components in URLs

  • Loading branch information...
alexarchambault committed Oct 1, 2018
1 parent 2d1baf0 commit 515ad32a5ab7a93168ceb5b8f8e901b3dae0c1f5
Showing with 5 additions and 17 deletions.
  1. +3 −3 doc/website/pages/index.html
  2. +1 −7 scripts/generate-website.sh
  3. +1 −7 scripts/relativize.sc
@@ -2,13 +2,13 @@
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=docs/intro/index.html">
<meta http-equiv="refresh" content="0; url=docs/intro">
<script type="text/javascript">
window.location.href = 'docs/intro/index.html';
window.location.href = 'docs/intro';
</script>
<title>Your Site Title Here</title>
</head>
<body>
If you are not redirected automatically, follow this <a href="docs/intro/index.html">link</a>.
If you are not redirected automatically, follow this <a href="docs/intro">link</a>.
</body>
</html>
@@ -45,15 +45,9 @@ echo
echo "Generated website available under $DIR"
if echo "$OSTYPE" | grep -q darwin; then
OPEN_CMD="open"
else
OPEN_CMD="xdg-open"
fi
cat << EOF
Open the generated website with
$OPEN_CMD doc/website/build/coursier/index.html
npx http-server doc/website/build/coursier
EOF
View
@@ -42,13 +42,7 @@ object Relativize {
val absoluteHref = URI.create(element.attr(s"abs:$attribute"))
if (absoluteHref.getHost == baseUri.getHost) {
val hrefPath = Paths.get(absoluteHref.getPath)
val relativeHref = {
val relativePath = originPath.relativize(hrefPath)
val absolutePath = file.getParent.resolve(relativePath)
val isDirectory = Files.isDirectory(absolutePath)
if (isDirectory) relativePath.resolve("index.html")
else relativePath
}
val relativeHref = originPath.relativize(hrefPath)
val fragment =
if (absoluteHref.getFragment == null) ""
else "#" + absoluteHref.getFragment

0 comments on commit 515ad32

Please sign in to comment.