# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- <html>nodewords.module (<b>2013-01-03 08:14:47</b>)</html>
+++ <html><b>Current File</b></html>
@@ -1313,13 +1313,30 @@
     return array('type' => NODEWORDS_TYPE_FORUM, 'id' => 0);
   }
 
+  $current_path = _nodewords_path_humanize($_SERVER['QUERY_STRING']);
+  $path = $current_path;
+
   // Check all of the custom page paths.
-  foreach (_nodewords_get_pages_paths() as $pid => $path) {
+  foreach (_nodewords_get_pages_paths() as $pid => $path_expr) {
     // The path is a system path.
-    if (drupal_match_path($_GET['q'], $path)) {
+
+    $regexp = '/^('. 
+      preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), 
+        array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), 
+        preg_quote($path_expr, '/')) .
+        ')$/';
+    
+    $page_match = preg_match($regexp, $current_path);
+    
+    if ($page_match > 0) {
       return array('type' => NODEWORDS_TYPE_PAGE, 'id' => $pid);
     }
 
+    // The path is a system path.
+    if (drupal_match_path($_GET['q'], $path_expr)) {
+      return array('type' => NODEWORDS_TYPE_PAGE, 'id' => $pid);
+    }
+
     // The path is a URL alias.
     $alias = drupal_get_path_alias($_GET['q']);
     if ($alias != $_GET['q'] && drupal_match_path($alias, $path)) {
@@ -1579,7 +1596,7 @@
         break;
 
       case NODEWORDS_TYPE_PAGE:
-        $path = $_GET['q'];
+        $path = _nodewords_path_humanize($_SERVER['QUERY_STRING']);
         break;
 
       case NODEWORDS_TYPE_TERM:
@@ -1646,3 +1663,13 @@
 
   $tags[$tag_name] = $content['value'];
 }
+
+
+/*
+ * Translate path from QUERY_STRING to path seen in addressbar
+ */
+function _nodewords_path_humanize($path) {
+  $path = str_replace('q=', '', $path);
+  $path = preg_replace('/&/', '?', $path, 1);
+  return urldecode($path);
+}
\ No newline at end of file
