0

私のウェブサイトには、すべてのプロジェクトの親指を一覧表示するページがあります。特定のサム (プロジェクト) をクリックすると、Fancybox はプロジェクトの詳細を iframe にロードします。すべてうまくいきます!(iframe のコンテンツには、ナビゲーション、ヘッダー、その他の Web サイト要素は含まれません。)

私が抱えている問題は、Google の検索結果ページにあります。Google はすべての詳細ページをインデックスに登録しました。ユーザーが Google の結果からリンクをクリックすると、ブラウザで詳細コンテンツ ページが開かれます (代わりに Fancybox iframe)。詳細ページにはナビゲーション ページが含まれていないため、これは好ましくありません。

ユーザーフレンドリーなソリューションはありますか?

4

2 に答える 2

1

それらのページが Google によってインデックスされていなくても問題ない場合は、リンクに rel="nofollow" を追加できます。

詳細はこちら: http://support.google.com/webmasters/bin/answer.py?hl=ja&answer=96569

于 2012-09-03T21:46:35.057 に答える
0

コメントで述べたように、各「詳細」ページに、URL をスニッフィングし、そのページが新しいウィンドウ (トップ ページ) で開かれたかどうかを検出するスクリプトを含める必要があります。メインページからfancyboxの「詳細」ページを開くことができるURL(hashたとえばを使用)。

したがって、各「詳細」ページに次のスクリプトを含めることができます。

<script type="text/javascript">
var isWindow = self == top; // returns true if opened in a new window, otherwise it migh be inside an iframe
if(isWindow){ 
 // alert("this page was opened in a new browser window");
 // then redirect to main page and add hash "detailedXX"
 window.location = "{URL}/mainpage.html#detailed01"
}
</script>

detailed01「詳細」ページごとに異なる値に変更します。

次に、メインページに、次のような各詳細ページへのリンクがある場合があります

<a id="detailed01" class="fancybox" href="detailed01.html">Open project detail page 01 in fancybox</a>
<a id="detailed02" class="fancybox" href="detailed02.html">Open project detail page 02 in fancybox</a>

メイン ページにリダイレクトするときに使用する にID一致する to each アンカーが含まれていることに注意してください。hash

次に、fancybox スクリプトは次のようになります。

<script type="text/javascript">
var thisHash = window.location.hash;
$(document).ready(function() {
 if(window.location.hash) {
  // get the URL without hash so we can restore it if needed
  var thisWindowLocation = window.location;
  var thisWindowLocationSplit = String(thisWindowLocation).split("#")[0];
  $(thisHash).fancybox({
   width: 800,
   height: 320,
   fitToView: false,
   autoSize : false,
   type: 'iframe',
   afterClose : function(){
    // returns URL to main page with no hash
    window.location = thisWindowLocationSplit
   }
  }).trigger('click');
 }
// fancybox for normal main page operation
 $(".fancybox").fancybox({
  width: 800,
  height: 320,
  fitToView: false,
  autoSize : false,
  type: 'iframe'
 });
}); // ready
</script>

ここにDEMOを設置しました

このデモでは、2 つの「詳細」ページが開きます。

http://www.picssel.com/playground/jquery/detailed01.html および http://www.picssel.com/playground/jquery/detailed02.html

それらを直接開こうとすると、呼び出し元のページにリダイレクトされ、fancybox で開きます

于 2012-09-03T21:38:51.593 に答える