ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/website/www.git/commit/?id=eb89af63ead8085823aa96c172d529efd7b68c21

commit eb89af63ead8085823aa96c172d529efd7b68c21
Author: Andy Williams <a...@andywilliams.me>
Date:   Wed Nov 1 11:14:29 2017 +0000

    WIKI CUSTOM - automatically use .md file when it exists
    
    Just a handy way to not have .md in the URL
---
 public_html/inc/pageutils.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/public_html/inc/pageutils.php b/public_html/inc/pageutils.php
index 69f4a09f..49441b22 100644
--- a/public_html/inc/pageutils.php
+++ b/public_html/inc/pageutils.php
@@ -90,6 +90,8 @@ function getID($param='id',$clean=true){
     if($clean) $id = cleanID($id);
     if(empty($id) && $param=='id') $id = $conf['start'];
 
+    if(page_exists($id.'.md'))
+        return $id.'.md';
     return $id;
 }
 
@@ -570,7 +572,10 @@ function 
resolve_pageid($ns,&$page,&$exists,$rev='',$date_at=false ){
     }else{
         //check alternative plural/nonplural form
         if(!file_exists($file)){
-            if( $conf['autoplural'] ){
+            if(file_exists($file.'.md')){
+                $page.='.md';
+                $exists = true;
+           }elseif($conf['autoplural'] ){
                 if(substr($page,-1) == 's'){
                     $try = substr($page,0,-1);
                 }else{

-- 


Reply via email to