Website URLs should be all lowercase #4

Open
bittner opened this Issue Jul 1, 2012 · 8 comments

3 participants

@bittner
Polyglot Pythonistas member

As of today the pyjs.org website URLs contain capital letters (e.g. in http://pyjs.org/About.html)

  1. We should change that to all lowercase (e.g. http://pyjs.org/about.html) following the common scheme of all lowercase URLs in web development.
  2. Also, we should discuss whether or not to remove the ".html" (e.g. make the URL be http://pyjs.org/about)
@eukreign eukreign was assigned Jul 1, 2012
@anthonyrisinger
Polyglot Pythonistas member

yeah i agree here, but i'm not sure how to go about all of it. i can convert to lowercase during the wiki-to-site process (i think), but removing .html is trickier ... since the site is 100% static the only way i see would work is automatically converting {page}.html to {page}/index.html ... which isn't all that bad but possibly error prone. will need to look into docutils options a bit more.

i also can't figure out how to combine jekyll features with wiki pages either; jekyll needs yaml "front matter" to trigger directives (like TOC and all other features) and i can't figure out how to hide that from the wiki output.

@bittner
Polyglot Pythonistas member

We shouldn't overcomplicate things. If it isn't accomplished easily (i.e. in a concise, straightforward manner) let's forget about it. No page/index.html, that would be ugly.

Usually this is accomplished with mod_rewrite on Apache. What is the webserver we have at hand? Can we use .htaccess?

@anthonyrisinger
Polyglot Pythonistas member

well it's not all that bad -- this would be the generated output only. {page}/index.html means we could access /about.html like /about/.

since currently the website is hosted by Github we have to work within their boundaries, which means jekyll directives or simply static. we could move the site to my dedicated server, but i'd like to avoid that if possible, since Github is more-or-less-rock-solid. however, if it went to my server, we would be using uWSGI (possibly fronted by Mongrel2) in which case rewrite rules become trivial.

@bittner
Polyglot Pythonistas member

(Is there no way to add an attachment to an issue here? Strange...)

I believe the following two changes would get the lower case URLs realized: (untested!)

$ git diff build.py
diff --git a/build.py b/build.py
index 8d0566f..d3a8375 100755
--- a/build.py
+++ b/build.py
@@ -14,7 +14,7 @@ def makeWikiLink(m):
     name = link = parts[0]
     if len(parts) == 2:
         link = parts[1]
-    return '`%s <%s.html>`_' % (name, link)
+    return '`%s <%s.html>`_' % (name, link.lower())

 def makeTemplate(menu):
     menu = menu.replace('<li><strong>', '<li class="section">')
@@ -56,7 +56,7 @@ def generateSite(opts):
     nfiles = float(len(wikiPages))
     for i, page in enumerate(wikiPages):
         name = basename(page)[:-5]
-        outname = join(opts.target, name+'.html')
+        outname = join(opts.target, name.lower() + '.html')
         log.progress(i/nfiles, outname)
         html = wikiToHTML(page)
         writeHTML(html, template, outname)
@anthonyrisinger
Polyglot Pythonistas member

i'm not sure how to attach -- normally you link the issue with some commits in your repo, ie. pull request, but i'm unsure how to do that after the fact ...

@anthonyrisinger
Polyglot Pythonistas member

i think you're on the right track, but i'm going to try the /page/index.html thing ... it's just build output so it's not like we have to maintain it that way. also, i'll add support for subdirectories but converting any _ in the document name to /. after these changes we should be able to make most anything.

@anthonyrisinger
Polyglot Pythonistas member

hooray! https://github.com/pyjs/pyjs.org/blob/master/Overview.rest

i just realized that Github will render marked up text files directly from a repo ... so we don't even need to use the wiki! this is fantastic because it solves several issues:

  • users can still navigate/view easily
  • users can still edit on the spot (auto-fork!) so we can handle user edits like other code
  • ... but cannot create new pages without cloning (which is perfect)
  • user changes can be controlled thru pull-requests like usual
  • events notification for autobuilding becomes much simpler (repo events are better supported and richer than wiki events)
  • no longer have to deal with Gollum quirks (wiki) and instead can use pure ReST

the only slight issue is linking, which can get a little hacky. i got images to link correctly by pointing to ../../raw/HEAD/<path-to-image> which essentially exploited Github structure (unlikely to change), and could be easily stripped before deployment ... might be better to just make everything flat, not sure here (thoughts?).

this weekend i'll work toward moving wiki content to the actual repo.

@anthonyrisinger
Polyglot Pythonistas member

i haven't quite got to this yet, but after working with sphinx heavily this weekend to generate a jewelry site for my fiance ... it's now clear that sphinx is badass and customizable to the nines.

am now working to generate the API docs and site with same look and feel -- we can then work toward uber customization with ease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment