私はブログテンプレートを使用しています.squarespace 6は、.html /へのアクセスを許可せず、.cssへのアクセスを制限しています
ブログ投稿を作成するたびに、タグとカテゴリを追加しますが、これらのタグ/カテゴリはブログ投稿の下部に配置されます。それらをサイドバーに移動しようとしています。
問題は、ページごとに複数のブログ投稿があることです。jquery を使用して.tags
と.category
クラスを選択し、次のような with コードの.sidebar
前に移動しようとしています。.date
$(document).ready(function(){
var $categories = $('div.categories').parent('article');
var $spanDate =('span.date').parent('article');
$categories.insertBefore($spanDate);
});
(このコードは .categories の例にすぎません)
問題は、このコードがすべてのブログ投稿からタグ/カテゴリを取得し、それをすべてのサイドバーに適用するため、カテゴリとタグが混同されることです.
親記事の.tags
とを選択し、それらを に移動するコードを取得しようとしています。同じ親の。.category
sidebar
article
これをすべてのブログ投稿に適用したいので、特定の ID を使用することはできませんが、タグ/カテゴリはその投稿内にとどまる必要があります。
挿入されたコードはたくさんありますが、HTML の基本構造は次のとおりです。
<blog> //Wrapper for the whole blog page
<content>
<article> //Each article is a blog entry
<section class="main"> //Contains the contents of the blog entry. This also has a dynamically generated ID,
//Blog Entry Content Goes Here
<footer>
<div class="meta"> //Contains the tags/categories I try to pull out of the DOM
<span class="tags"></span> //Contains the tags each wrapped in an `<a>`
<span class="categories"></span> //Contains the category tags
</div>
</footer>
</section>
<section class="sidebar"> //This is where I'm trying to place the tags/categories
<span class="date"></span> //I try to place the category before this in the jquery code above
<more spans....> // I try to place the tags appended onto the end of the sidebar (code not shown above).
</section>
</article>
<article></article> //More blog entries with same structure
<article></article> //More blog entries with same structure
<article></article> //More blog entries with same structure
</content>
</blog>