CMS Development

victorwu
参加者

can i sort tag post by different blog?

i want to create different blog's tag in a list.

also can link to a list show post in same tag. how can i do ? 

for set blog_tags('default') is show list of template witch blog used.

for example: i've a domain with blog index page , also list all tags.

and created two of blog below domain : https://myblog/blog-a and https://myblog/blog-b.

so i want to click tag link in list to show two of blog in a blog list,  how can i do?

i want to list different blog's tag no repeati want to list different blog's tag no repeat

2件の返信
liam_mccolgan
参加者

can i sort tag post by different blog?

Bumping this. I have a very similar issue.

 

We have a 'main blog' in which a custom module pulls in posts from 4 other 'catergory blogs'. 

 

We can't get the filter module ( post by tags ) to show all tags from all 4 category blogs.

 

Currently our code only shows tags that are attached to blog listings/posts on the current page. We need to show the tags from all 4 blogs.

 

We used similar logic ( definining all 4 blogs via ID's) but it's not pulling through.

 

Any help would be appreciated! 

0 いいね!
victorwu
参加者

can i sort tag post by different blog?

your problem is easy to set  below:

 

{% set post_tag_one = blog_tags(yourblogID, 250) %}
{% set post_tag_two = blog_tags(yourblogID, 250) %}
{% set post_tag_three = blog_tags(yourblogID, 250) %}
{% set post_tag_all = (post_tag_one + post_tag_two + post_tag_three)|sort('False', 'publish_date')|unique %}

 

and do for in to list "post_tag_all" out to page.

 

{% for item in post_tag_all %}
{% if item %}
<li class="tag_item" onclick='location.href="http://your_blog_domain/page/list_all?tagname={{ item }}"'>{{ item }}</li>
{% endif %}
{% endfor %}

 

create a list page in index blog (there will guide all blogs in a list page)

end throught URL to get tagname to post list page.

 

{% set Qstring = request.query_dict.tagname|lower %}

 

Qstring will be name user clicked.

so just use this name to show on post:

each blog should have a post template and set same query code above.

 

{% set tag_posts_one = blog_recent_tag_posts(blogpostID , [ Qstring ] , 100) %}

{% set tag_posts_two = blog_recent_tag_posts(blogpostID , [ Qstring ] , 100) %}

{% set tag_posts_three = blog_recent_tag_posts(blogpostID , [ Qstring ] , 100) %}

{% set tag_posts_all = (tag_posts_one + tag_posts_two + tag_posts_three)|sort('True','False', 'publish_date')|lower %}

 

 

list it out will success.

0 いいね!