View Issue Details

IDProjectCategoryView StatusLast Update
0007573mantisbtbugtrackerpublic2014-10-05 03:02
Reporterrickb Assigned Tograngeway  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionwon't fix 
PlatformAnyOSAny 
Product Version1.0.5 
Summary0007573: add link elements to head of each page
Description

HTML allows for <link> elements in the header to indicate relationships from a page to several other pages. A useful way to use this is for the "previous" and "next" links to be expressed in the head (as well as via <a> links in the body of course).

Please add something to the head of relevant pages that puts <link> elements in.

Additional Information

Example <link>s

<link href="main_page.php" rel="Top" />
<link href="view_all_bug_page.php" rel="up" />
<link href="bug_view_page.php?bug_id=1234" rel="prev" />
<link href="bug_view_page.php?bug_id=1232" rel="next" />

FYI see http://www.w3.org/TR/html4/struct/links.html

Tagspatch
Attached Files
7573.diff (3,402 bytes)   
--- core/html_api.php	Thu Jan 15 06:14:12 1970
+++ core/html_api.php	Thu Jan 15 06:14:12 1970
@@ -159,8 +159,8 @@
  * @param string $p_redirect_url url to redirect to if necessary
  * @return null
  */
-function html_page_top( $p_page_title = null, $p_redirect_url = null ) {
-	html_page_top1( $p_page_title );
+function html_page_top( $p_page_title = null, $p_redirect_url = null, $p_extra_headers = null ) {
+	html_page_top1( $p_page_title, $p_extra_headers );
 	if ( $p_redirect_url !== null ) {
 		html_meta_redirect( $p_redirect_url );
 	}
@@ -172,7 +172,7 @@
  * @param string $p_page_title page title
  * @return null
  */
-function html_page_top1( $p_page_title = null ) {
+function html_page_top1( $p_page_title = null, $p_extra_headers = null ) {
 	html_begin();
 	html_head_begin();
 	html_css();
@@ -183,7 +183,11 @@
 	if ( !is_blank( $g_robots_meta ) ) {
 		echo "\t", '<meta name="robots" content="', $g_robots_meta, '" />', "\n";
 	}
-
+	if ( $p_extra_headers !== null ) {
+		foreach ( $p_extra_headers as $t_header ) {
+			echo "\t", $t_header, "\n";
+		}
+	}
 	html_rss_link();
 
 	$t_favicon_image = config_get( 'favicon_image' );
--- bug_view_inc.php	Thu Jan 15 06:14:12 1970
+++ bug_view_inc.php	Thu Jan 15 06:14:12 1970
@@ -61,14 +61,30 @@
 
 	compress_enable();
 
+	# prev/next <head> <link>
+	$t_bugslist = gpc_get_cookie( config_get( 'bug_list_cookie' ), false );
+	if ( $t_bugslist ) {
+		$t_bugslist = explode( ',', $t_bugslist );
+		$t_index = array_search( $f_bug_id, $t_bugslist );
+		if ( false !== $t_index ) {
+			if ( isset( $t_bugslist[$t_index-1] ) ) {
+				$t_prev_link = 'bug_view_page.php?bug_id='.$t_bugslist[$t_index-1];
+				$t_head_link_arr[] = '<link rel="Prev" href="'.$t_prev_link.'" />';
+			}
+			if ( isset( $t_bugslist[$t_index+1] ) ) {
+				$t_next_link = 'bug_view_page.php?bug_id='.$t_bugslist[$t_index+1];
+				$t_head_link_arr[] = '<link rel="Next" href="'.$t_next_link.'" />';
+			}
+		}
+	}
+
 	if ( $tpl_show_page_header ) {
-		html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
+		html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ), null, $t_head_link_arr );
 		print_recently_visited();
 	}
 
 	$t_action_button_position = config_get( 'action_button_position' );
 
-	$t_bugslist = gpc_get_cookie( config_get( 'bug_list_cookie' ), false );
 
 	$tpl_show_versions = version_should_show_product_version( $tpl_bug->project_id );
 	$tpl_show_product_version = $tpl_show_versions && in_array( 'product_version', $t_fields );
@@ -241,16 +257,12 @@
 	# prev/next links
 	if ( $t_bugslist ) {
 		echo '<td class="center"><span class="small">';
-
-		$t_bugslist = explode( ',', $t_bugslist );
-		$t_index = array_search( $f_bug_id, $t_bugslist );
-		if ( false !== $t_index ) {
-			if ( isset( $t_bugslist[$t_index-1] ) ) {
-				print_bracket_link( 'bug_view_page.php?bug_id='.$t_bugslist[$t_index-1], '&lt;&lt;' );
+		if ( isset( $t_prev_link ) || isset( $t_next_link ) ) {
+			if ( isset( $t_prev_link ) ) {
+				print_bracket_link( $t_prev_link, '&lt;&lt;' );
 			}
-
-			if ( isset( $t_bugslist[$t_index+1] ) ) {
-				print_bracket_link( 'bug_view_page.php?bug_id='.$t_bugslist[$t_index+1], '&gt;&gt;' );
+			if ( isset( $t_next_link ) ) {
+				print_bracket_link( $t_next_link, '&gt;&gt;' );
 			}
 		}
 		echo '</span></td>';
7573.diff (3,402 bytes)   

Activities

rickb

rickb

2006-11-07 08:40

reporter   ~0013690

In Firefox, the <link> elements are not visible out of the box. The Link Widgets addon is needed to access them. See https://addons.mozilla.org/firefox/2933/

ryandesign

ryandesign

2006-11-07 20:58

reporter   ~0013695

I don't know that linking to the next or previous issue, numerically, is useful at all. Perhaps linking to the next and previous issues in the current list of issues would be useful. But if we add <link> tags for those, I would also want <a href> tags added somewhere in the page. There's no point only making <link> tags, since I don't know of any mainstream browser that makes use of those.

Adding <link> tags for issues related to the current one could be interesting.

rickb

rickb

2006-11-08 05:21

reporter   ~0013698

I quite agree there's not much point having numerical chaining of issues that differs from what the << >> buttons do.

Because we already have << and >> links for the chain of issues in the current view, these are the links I had in mind in making my suggestion.

The page layout is slightly different from one page to the next. Therefore, the << >> buttons move slightly, so clicking quickly through them takes a bit more attention - so being a bit more distracting. Having <link> equivalents for these two buttons gains the benefit for users of having buttons in one place on the UI as they step through their list of issues.

ryandesign

ryandesign

2006-11-08 13:21

reporter   ~0013703

I forgot we already have << and >> links on the page. In light of that, adding correspending <link> elements makes sense.

Sergiodf

Sergiodf

2010-11-30 15:58

reporter   ~0027519

I have attached a patch for Mantis 1.2.3.
Tested in Mantis 1.2.1 using Seamonkey 2.0.10 and Firefox 3.6.12 + Site navigation bar 2.0.3.

dhx

dhx

2010-11-30 20:20

reporter   ~0027520

Great idea. Thanks for the patch too. I've queued this up for 1.3.x.

atrol

atrol

2013-04-27 18:41

developer   ~0036709

Removed assignment. dhx will not contribute to this issue in near future.

grangeway

grangeway

2014-09-24 15:36

reporter   ~0041308

I think in our case, this is a case of resolving as "wont fix".

For this functionality to work, from what I can tell, you'd need to add a custom plugin to any of the major browsers to use it.

In addition, if I look at information from the likes of google - for example: http://googlewebmastercentral.blogspot.co.uk/2011/09/pagination-with-relnext-and-relprev.html, and i'll quote:

"if you choose to include rel=”next” and rel=”prev” markup on the component pages within a series, you’re giving Google a strong hint that you’d like us to:
Consolidate indexing properties, such as links, from the component pages/URLs to the series as a whole (i.e., links should not remain dispersed between page-1.html, page-2.html, etc., but be grouped with the sequence).
Send users to the most relevant page/URL—typically the first page of the series."

This feels quite dangerous for a public internet indexed tracker. It could imply that every bug in the tracker is related to the first bug when indexing, which could start to have undesirable results.

The original reporters rationale for adding the buttons seems to be partly due to the << >> moving when changing between pages - I think we'd probably be better fixing that - then the navigation remains consistent regardless of what browser people use.