]> sipb.mit.edu Git - ikiwiki.git/commitdiff
better handling of relative permalinks
authorJoey Hess <joey@kitenet.net>
Wed, 5 Jan 2011 20:26:09 +0000 (16:26 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 5 Jan 2011 20:26:09 +0000 (16:26 -0400)
This way, do=goto will go to the page relative to
the current location, while the permalinks in feeds
will be absolute (unless an url is not configured at all).

IkiWiki/Plugin/comments.pm
IkiWiki/Plugin/meta.pm
IkiWiki/Plugin/recentchanges.pm
doc/todo/want_to_avoid_ikiwiki_using_http_or_https_in_urls_to_allow_serving_both.mdwn

index cdb9262710bd4f86ef4ded3e36833331dcce9d82..f3d6f20d6a3d9dab224e5ddff140f1a86edb772e 100644 (file)
@@ -237,7 +237,7 @@ sub preprocess {
        }
 
        if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) {
-               $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page}), undef, 1).
+               $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page})).
                        "#".page_to_id($params{page});
        }
 
index abc8f1b1aa1089f60ba62e93dbcca0062696f4f6..ad6d1a8e338895685be79486c5b4dac95f9c21b9 100644 (file)
@@ -298,6 +298,11 @@ sub pagetemplate (@) {
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
        }
 
+       foreach my $field (qw{permalink}) {
+               $template->param($field => IkiWiki::urlabs($pagestate{$page}{meta}{$field}, $config{url}))
+                       if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
+       }
+
        foreach my $field (qw{description}) {
                $template->param($field => HTML::Entities::encode_numeric($pagestate{$page}{meta}{$field}))
                        if exists $pagestate{$page}{meta}{$field} && $template->query(name => $field);
index 92083a7ad6ad5c9bf33743489b9ac2a143366f11..d6292c3f20f51af905e8f7e0e961baac9b5818d3 100644 (file)
@@ -225,7 +225,7 @@ sub store ($$$) {
                wikiname => $config{wikiname},
        );
        
-       $template->param(permalink => urlto($config{recentchangespage}, undef, 1)."#change-".titlepage($change->{rev}))
+       $template->param(permalink => urlto($config{recentchangespage})."#change-".titlepage($change->{rev}))
                if exists $config{url};
        
        IkiWiki::run_hooks(pagetemplate => sub {
index dfe41e138200e4f55fc69919016b4cd4d5a571fe..143bf0edcdaa79dd4e37cb1758c187be0083a55a 100644 (file)
@@ -23,6 +23,8 @@
   to absolute urls when fulling out templates, while allowing them
   to be left as partial urls internally, for use by goto. --[[Joey]]
 
+  > This reversion has now been fixed. --[[Joey]]
+
 ## old attempt
 
 It looks like all links in websites are absolute paths, this has some limitations: