diff --git a/app.js b/app.js index 18d7344..b56729e 100644 --- a/app.js +++ b/app.js @@ -38,6 +38,7 @@ function initApp (config, callback) { // View helpers require('./view/helper/date')(hbs.registerHelper); + require('./view/helper/url')(hbs.registerHelper); // Populate view locals app.express.locals({ diff --git a/view/helper/url.js b/view/helper/url.js new file mode 100644 index 0000000..872e509 --- /dev/null +++ b/view/helper/url.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = helper; + +function helper (register) { + + // Simplify url by removing (eg http://, https://, trailing slashes) from url + register('simplify-url', function (context) { + return context.replace(/^https?:\/\//i, '').replace(/\/$/, ''); + }); + +} diff --git a/view/partial/tasks.html b/view/partial/tasks.html index 3ef8d1a..246b8a9 100644 --- a/view/partial/tasks.html +++ b/view/partial/tasks.html @@ -9,7 +9,7 @@ {{#tasks}}
  • -

    {{url}}

    +

    {{simplify-url url}}

    ({{standard}})

    {{#if last_result}}