This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch gc/8423
in repository https://gitbox.apache.org/repos/asf/allura.git

commit e7888639e899a93e50d5599bf44c0cf084d012b7
Author: Guillermo Cruz <[email protected]>
AuthorDate: Thu Mar 31 09:55:28 2022 -0600

    [#8423] improvements on wiki pages versions
---
 ForgeWiki/forgewiki/templates/wiki/page_view.html | 8 ++++++--
 ForgeWiki/forgewiki/wiki_main.py                  | 5 ++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html 
b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 20b5b6a..2e94265 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -20,6 +20,8 @@
 {% do g.register_forge_css('css/forge/hilite.css', compress=False) %}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 
+{%  set base_url = page.url().split('?')[0] %}
+
 {% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / 
{{page.title}}{% endblock %}
 
 {% block header %}{{page.title}}{% if page['deleted'] %}<span> 
(deleted)</span>{% endif %}{% endblock %}
@@ -39,7 +41,8 @@
 <link rel="alternate" type="application/atom+xml" title="Page Atom" 
href="feed.atom"/>
 <link rel="alternate" type="application/rss+xml" title="Wiki RSS" 
href="../feed.rss"/>
 <link rel="alternate" type="application/atom+xml" title="Wiki Atom" 
href="../feed.atom"/>
-<link rel="canonical" href="{{ h.absurl(page.url()) }}">
+<link rel="canonical" href="{{ h.absurl(base_url) }}">
+
 {% endblock %}
 {% block body_css_class %} {{super()}} wiki-{{(page.title).replace(' 
','_')}}{% endblock %}
 
@@ -50,7 +53,7 @@
       {% elif c.user.is_anonymous() and h.is_allowed_by_role(page, 'edit', 
'*authenticated', c.project) %}
           <a href="{{ tg.config.get('auth.login_url', '/auth/') }}">Log in to 
Edit</a>
       {% endif %}
-      {{ g.icons['history'].render(href='history') }}
+      {{ g.icons['history'].render(href='history',rel='nofollow') }}
   {% elif h.has_access(page, 'delete')() %}
     {{ g.icons['undelete'].render(extra_css='post-link') }}
     <div class="confirmation_dialog" style="display:none">
@@ -75,6 +78,7 @@
 {% endblock %}
 
 {% block wiki_content %}
+    {%  if not is_latest_version %}<div data-alert class="alert-box 
info"><p>You can find the latest version of this page <a href="{{ base_url }}" 
rel="nofollow">here</a></p></div>{% endif %}
 <div{% if h.has_access(page, 'edit') %} class="active-md" data-markdownlink="" 
{% endif %}>{{page.html_text}}</div>
 {% endblock %}
 
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 180d3ea..4228c8c 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -605,13 +605,16 @@ class PageController(BaseController, FeedController):
         next = cur + 1
         hide_left_bar = not (c.app.show_left_bar)
         subscribed_to_page = M.Mailbox.subscribed(artifact=self.page)
+        latest_version = self.page.history().limit(1).first()
+        is_latest_version = cur == latest_version.version
         return dict(
             page=page,
             cur=cur, prev=prev, next=next,
             page_subscribed=subscribed_to_page,
             hide_left_bar=hide_left_bar, show_meta=c.app.show_right_bar,
             pagenum=pagenum, limit=limit, count=post_count,
-            noindex=c.app.should_noindex_page(self.page))
+            noindex=c.app.should_noindex_page(self.page),
+            is_latest_version=is_latest_version,)
 
     @without_trailing_slash
     @expose('jinja:forgewiki:templates/wiki/page_edit.html')

Reply via email to