From 7aee86d955b5a442f122ef57a5b3a4dac24eb323 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 16 Jun 2018 05:43:12 +0200 Subject: [PATCH] nieuws: create article urls with dash separators Prompt for "link" to clarify purpose, and replace spaces (as most sites do). --- nieuws/edit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nieuws/edit.js b/nieuws/edit.js index 86b0b4c..3155ac0 100644 --- a/nieuws/edit.js +++ b/nieuws/edit.js @@ -3,10 +3,10 @@ editlink.className = 'nav'; editlink.appendChild(document.createTextNode('Nieuw artikel')); editlink.onclick = function () { var today = new Date().toJSON().slice(0, 10).split('-'); - var input = prompt('Paginatitel', ''); + var input = prompt('Paginalink (beknopte titel)', ''); if (!input) return false; var url = today[0] + '/' + today[1] + '-' + today[2] + '-' + - input.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim(); + input.toLowerCase().replace(/[^a-z0-9]+/g, '-').trim(); var title = encodeURIComponent(input.trim()); window.location = '/nieuws/'+url+'?edit='+title+'#edit'; return false; -- 2.30.0