From 8a404b02a8d89f13d64557525ca31ae249692035 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 5 Apr 2016 22:39:35 +0100 Subject: [PATCH] Remove extra url reversing --- static/src/js/components/breadcrumbs.js | 3 ++- templates/base.html | 2 +- templates/projects/morse-code-decoder.md | 2 +- templates/projects/test.md | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/static/src/js/components/breadcrumbs.js b/static/src/js/components/breadcrumbs.js index 3565a10..bdbaa51 100644 --- a/static/src/js/components/breadcrumbs.js +++ b/static/src/js/components/breadcrumbs.js @@ -2,7 +2,8 @@ import React from 'react'; export default class Breadcrumbs extends React.Component { render() { - const urlParts = Object.freeze(location.pathname.split('/').slice(1, -1)); + const loc = location.pathname.endsWith('/') ? location.pathname.slice(0, -1) : location.pathname; + const urlParts = Object.freeze(loc.split('/').slice(1)); if (urlParts.length < 2) { return null; } diff --git a/templates/base.html b/templates/base.html index 89c9e83..84a2338 100644 --- a/templates/base.html +++ b/templates/base.html @@ -31,7 +31,7 @@

- About | + About | View Source | Contact

diff --git a/templates/projects/morse-code-decoder.md b/templates/projects/morse-code-decoder.md index 76a52b1..54b874d 100644 --- a/templates/projects/morse-code-decoder.md +++ b/templates/projects/morse-code-decoder.md @@ -2,7 +2,7 @@ It's not often someone will need to decode text into morse code (and visa-versa), but if I had something like this when I needed it, it would have saved me hours of time! -I originally wrote this code for the [Student Robotics 2015]({% url 'robotics:2015-index' %}) Entry, to convert a string message into a morse code message that would be transmitted using LEDs, for aestetics and debugging. Unfortunately due to a fixed time frame, this idea was scraped before it could be fully implemented. Fortunately the decoder worked perfectly! +I originally wrote this code for the [Student Robotics 2015](/robotics/2015/) Entry, to convert a string message into a morse code message that would be transmitted using LEDs, for aestetics and debugging. Unfortunately due to a fixed time frame, this idea was scraped before it could be fully implemented. Fortunately the decoder worked perfectly! ## Usage diff --git a/templates/projects/test.md b/templates/projects/test.md index e5e71f7..6b7115f 100644 --- a/templates/projects/test.md +++ b/templates/projects/test.md @@ -1,4 +1,4 @@ # Testing This page is for testing only. -Please [check out my other projects]({% url 'projects:all' %}). +Please [check out my other projects](/projects/all).