Commit cc57df8f authored by Mariano Montone's avatar Mariano Montone

Fix urls when serving

parent a26535f7
all: generate
serve:
cd output; python -m SimpleHTTPServer
#cd output; python -m SimpleHTTPServer
cd output; python ../server.py
static:
cp -r content/static output/static
......
......@@ -6,14 +6,14 @@
<title>{{title}}</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700" rel="stylesheet" type="text/css">
<link href="./static/css/layout_2018.css" rel="stylesheet" type="text/css">
<link href="/layout_2018.css" rel="stylesheet" type="text/css">
{{#styles}}
<link href="{{location}}" rel="stylesheet" type="text/css">
{{/styles}}
</head>
<body>
<nav class="navbar navbar-expand-md fixed-top navbar-dark navigation">
<a class="navbar-brand" href="./index.html">
<a class="navbar-brand" href="/">
<img width="30px" height="30px"
src="/static/imgs/lisplogo.png" />
Common-Lisp.net</a>
......@@ -24,41 +24,41 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="./about/">About</a>
<a class="nav-link" href="/about/">About</a>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Get started <span class="caret"></span></a>
<div class="dropdown-menu" role="menu">
<a class="dropdown-item" href="./downloads/">Download</a>
<a class="dropdown-item" href="./tutorials/">Tutorials</a>
<a class="dropdown-item" href="/downloads/">Download</a>
<a class="dropdown-item" href="/tutorials/">Tutorials</a>
</div>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Community <span class="caret"></span></a>
<div class="dropdown-menu" role="menu">
<a class="dropdown-item" href="http://mailman.common-lisp.net/cgi-bin/mailman/listinfo">Mailing lists</a>
<a class="dropdown-item" href="./independent-lists/">Independent lists</a>
<a class="dropdown-item" href="./orphaned-mailing-lists/">Orphane lists</a>
<a class="dropdown-item" href="/independent-lists/">Independent lists</a>
<a class="dropdown-item" href="/orphaned-mailing-lists/">Orphane lists</a>
</div>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Projects <span class="caret"></span></a>
<div class="dropdown-menu" role="menu">
<a class="dropdown-item" href="./phub/">Projects hub</a>
<a class="dropdown-item" href="./project-intro/">Hosting services</a>
<a class="dropdown-item" href="./orphaned-projects/">Orphaned projects</a>
<a class="dropdown-item" href="./faq/">FAQ</a>
<a class="dropdown-item" href="/phub/">Projects hub</a>
<a class="dropdown-item" href="/project-intro/">Hosting services</a>
<a class="dropdown-item" href="/orphaned-projects/">Orphaned projects</a>
<a class="dropdown-item" href="/faq/">FAQ</a>
</div>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Resources <span class="caret"></span></a>
<div class="dropdown-menu" role="menu">
<a class="dropdown-item" href="http://www.lispworks.com/documentation/lw50/CLHS/Front/Contents.htm">CLHS</a>
<a class="dropdown-item" href="./tools/">Tools</a>
<a class="dropdown-item" href="/tools/">Tools</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="./contribute/">Contribute</a>
<a class="nav-link" href="/contribute/">Contribute</a>
</li>
</ul>
</div>
......
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import os.path
import sys
class MyRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
possible_name = self.path.strip("/")+'.html'
if self.path == '/':
# default routing, instead of "index.html"
self.path = '/index.html'
elif os.path.isfile(possible_name):
# extensionless page serving
self.path = possible_name
return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
Handler = MyRequestHandler
port = 8000
if len(sys.argv) > 1:
try:
p = int(sys.argv[1])
port = p
except ValueError:
print "port value provided must be an integer"
print "Serving on port {0}".format(port)
server = SocketServer.TCPServer(('0.0.0.0', port), Handler)
server.serve_forever()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment