Multiple Blogs on one set, and BlogSearch page.

Permalink Browser Info Environment
Hello,

If I have multiple blogs on my site, let's say Bob's Blog, and Pete's Blog, and they both share a category named "Apple" and both have 2 posts using that category.

When I am on Bob's blog page it says there are 2 posts in the Apple category because I am telling the ProBlog List block to only look under this blog page.

But when I click on it, I am brought to a search page that everything shares. I will now see 4 Apple posts because Pete has 2 posts using that category.

How do I make it so these blogs are separate in terms of search results?

Is there a way you can create multiple search result pages and have different blogs use different search pages?

Thanks, and I hope that makes sense.

Type: Discussion
Status: In Progress
mikeTsilva
View Replies: View Best Answer
RadiantWeb replied on at Permalink Reply
RadiantWeb
This is a tough one. I'm going to have to think about this.

C
mikeTsilva replied on at Permalink Reply
mikeTsilva
Thank you so much for a reply. I really appreciate it.

I love to see somebody making quality add-ons for Concrete5, and Radiant Web has always impressed me.

I know what I am doing is a little bit out of the norm, and I hope I'm not causing too much trouble.

Thanks again,
mikolajkamler replied on at Permalink Reply
mikolajkamler
This is something I need to solve as well - I'd like the two blogs on my page not only to have separate search results pages, but also, as these two blogs have different designs, each of the search pages should match the design of its parent blog, to make it clear to which blog it refers.
For now, it seems impossible to do, as there's only one page which you can choose as the Blogsearch in the settings, but perhaps I'm wrong? I'm just a graphic designer with little programming experience, so this is quite possible...
Thanks in advance for any solution,

Mikołaj
designserve replied on at Permalink Reply
designserve
Regarding the design element, you could achieve that using the Multiple Domains addon.

Let's say you have two bloggers - Adam and Eve - each gets a subdomain. So, Adam's blog is adam.yoursite.com and Eve gets eve.yoursite.com

Someone visiting yoursite.com/adam would get redirected automatically to adam.yoursite.com and would then see adam's theme because the Multiple Domains addon will allow you to have a different theme for each of these subdomains. You apply a domain to the top page of the subdomain and it will automatically apply to all pages beneath it.

Regarding the separate blogsearches I'm not sure how to address that one.

If you went to adam.yoursite.com/blogsearch using the Multiple Domains addon then you would see the blogsearch with Adam's theme but it would also return Eve's results I think.

If you're interested I could test this and get back to you.

Here are four of my sites running on the same C5 installation using MD (there are more):

http://technicskn7000.com/
http://kn7000.co.uk/
http://technicskeyboards.com/
http://www.dsname.com/ (placeholder site)
http://songs.technicskn7000.com/...

Four different themes (even if the last one doesn't look different it is a separate custom theme). So you could easily assign a theme to each blogger to achieve different designs.

I only blog from one of these sites but I did accidentally blog from the wrong domain last week and it upped to Twitter etc from that second domain (I just deleted the tweet and re-sent it from the correct domain).

I understand that blogsearch is just a search page with a custom templatet, so there might be a way for it to be automatically filtered per domain by the MD addon. As I said, I'll check if you want.

Best wishes,
Mike
mikolajkamler replied on at Permalink Reply
mikolajkamler
Well, thanks for your suggestion, but I don't think I need it. The design differences between the two blogs are small - they are in fact two variants of one theme (one with the sidebar left, the other right etc.) The problem with Problog is that it needs me to set only one page for the blogsearch - one that searches for all posts of, say, a category (and has one variant of the theme, regardless of the blog on which the category link has been clicked). It can search site-wise or on pages beneath a specific page (the pages of one of the blogs, for example). What I'd need would be the possibility to search for posts in a category, made by a specific author - the author of the blog on which the search occurs.
designserve replied on at Permalink Reply
designserve
Yes I can understand that you might not need it for the design changes.

I think that adam.yoursite.com/blogsearch would return results limited to that subdomain (and therefore adam's posts) but I'm not certain.

If I add a search page to a subdomain or a separate domain it returns results specific to that subdomain or domain. This is by design in order not to create duplication. I'm not sure if it would be the same for a blogsearch but I think it would be.

I'll ask the developer and get back to you if the news is positive.
RadiantWeb replied on at Permalink Reply
RadiantWeb
The blogsearch single page was developed to do one thing:

- translate the ugly and unfriendly /page?search=1&akID[23][atSelectOption]=32 url.

The blogsearch singlepage controller translates /category/slug-name/ to ?search=1&akID[23][atSelectOption]=32 and performs a site search utilizing concrete5's standard search block.

This is much more of an edge case than it is standard protocol.

The only real way to achieve this and maintain clean urls for tags and categories is to set search_paths=/path from within the blogsearch controller based on HTTP_REFERER (not valid on all browsers) and parse out the main parent blog section from that. aka - not easy.

Something I am considering is forgoing the search block and just using that single page as the search results providing me a lot more flexibility with how it can be set up. (at the mercies of the search block and it's limitations currently) Remember, blocks can not utilize clean urls with routes within the controller. Only single pages can.

Again, I will have to work something up on this.

ChadStrat
RadiantWeb replied on at Permalink Best Answer Reply
RadiantWeb
Try replacing /packages/problog/controllers/blogsearch.php with this code:

http://laravel.io/bin/0lMdM

ChadStrat
RadiantWeb replied on at Permalink Reply
RadiantWeb
the following code was added:

$refered = str_replace(BASE_URL,'',str_replace('/index.php','',$_SERVER['HTTP_REFERER']));
      $rp = Page::getByPath($refered);
      if($rp){
          $parent = $blogify->getCanonicalParent(null,$rp);
          $_REQUEST['search_paths'][] = Page::getByID($parent)->getCollectionPath();
      }


This looks for HTTP_REFERER, extrapolates the main parent section for the referring post and if present creates a request var search_paths that the search block "should" honor.

ChadStrat
mikolajkamler replied on at Permalink Reply
mikolajkamler
Chad,
Thanks a lot for your help and for the code... Where should I add it, though? *NON-PROGRAMMER TALKING HERE* :-)

Mikołaj
mikeTsilva replied on at Permalink Reply
mikeTsilva
Hey Mikolajkamler

You need to go tohttp://laravel.io/bin/0lMdM and get the code, then go to your blogsearch.php file (found in the directory /packages/problog/controllers/) and replace all the contents of that file with the new code from thehttp://laravel.io/bin/0lMdM site.

I hope that helps ... you may need to adjust the permissions of the blogsearch.php file in order to save the file after you have updated it. (I had to SSH into the site and change ownership to save it, then when it was saved I changed the ownership back to apache for security purposes)
thenine replied on at Permalink Reply
thenine
Hi, I´m experiencing same issue. The difference in my case is I have two blog sections (corresponding to two different languages) and I don´t want the blogsearch to show shared results when I´m looking for post archives. Currently it shows results from both sections, mixed. Is it possible to achieve?

Thanks in advance
designserve replied on at Permalink Reply
designserve
I've tried my method and it does seem to work (but as you say with the ugly urls).

In order to make it work, individual search pages have to be made beneath the subdomains and called blogsearch.

adam.yoursite.com/blogsearch gets set to only search within that subdomain

and

eve.yoursite.com/blogsearch gets set to only search within that subdomain

Because problog looks for (BASEDOMAIN)/blogsearch, the multiple domains addon redirects to the correct page and only that individual blogger's results are returned (because the search block is only returning children of that subdomain... because I set it to search children of that page)

This might spark an idea for you of how to make it work without the MD addon.
mikeTsilva replied on at Permalink Reply
mikeTsilva
Thanks Chad,

This seems to work well ... I will have to separate the blogs to be all in the root of the directory, I had them all under /blogs, and it's still getting everything in the search box, but I know it will work because I still have the default /blog page from the install, and there are some test blogs there that DON'T show up on the search page. So your solution works.

The only other issue I have and it something I will have to live with ... The sidebar "Categories" and "Archives" are not in the Search box, so they are still set to pull from the entire site, and in the example above would still say there are 4 apples, even though the search box would only display 2 of the apple posts ...

It would be pretty awesome if one of the settings in the Problog-List Block was a choice of what search page to go to, and the entire issue would be solved.

I realize though that something like that might be a whole lot of coding though....

Thanks anyway Chad, your support is great, even when a customer like me wants to do something that wasn't meant to be able to do.
mikeTsilva replied on at Permalink Reply
mikeTsilva
So by chance ... would it be possible to add another field in the ProBlog-List block that let's you choose a different search result page?

And if not changed, it would just use the default that is set in the ProBlog settings?
RadiantWeb replied on at Permalink Reply
RadiantWeb
The blogsearch page was changed to support filter by /parent now. That said, you will want to set up your site to have multiple parents that coincide with your categories. To do so, remove the "blog_section" attribute from the '/blog' page, and then create two pages underneath /blog. /blog/categoryname1/ & /blog/categoryname2/. Then add the "blog_section" attribute to those pages. This will allow you to post blog entries to multiple destinations and then also allow the /blogsearch page to filter by parent adequately.

ChadStrat
mikolajkamler replied on at Permalink Reply 1 Attachment
mikolajkamler
Thanks Chad for all your help.
So, if I have a site structure which is a bit different: the site is divided into two parts - each of them has subpages, one of which is a blog (I attached a picture of the structure to make it clearer) - would that work as well? And what should I change to make it work? Right now, each of the blog pages has the "blog_section" attribute checked.

Mikołaj
RadiantWeb replied on at Permalink Reply
RadiantWeb
if you are on the latest version it should. I suppose it would fail when HTTP_REFERER is empy:

http://stackoverflow.com/questions/6880659/in-what-cases-will-http-...

$refered = str_replace(BASE_URL,'',str_replace('/index.php','',$_SERVER['HTTP_REFERER']));
$rp = Page::getByPath($refered);
if($rp){
       $parent = $blogify->getCanonicalParent(null,$rp);
       $_REQUEST['search_paths'][] = Page::getByID($parent)->getCollectionPath();
}


ChadStrat
mikolajkamler replied on at Permalink Reply
mikolajkamler
Still, one problem remains - each of my two blogs uses a different page design. One is "sidebar-left", the other - "sidebar-right", they have different fonts in headlines and so on. These are small differences, but make it easy to see whether what you see is one blog or the other. Would there be a way to make two versions of the blogsearch page - each one with the same design as its "parent" blog?

Anyway, thanks a lot for all your help,

Mikołaj
thenine replied on at Permalink Reply 1 Attachment
thenine
I´m afraid it´s not working under my structure, which I attach here. I´m using multilingual to create 2 separate trees (Spanish and Catalan, which are different languages although you are watching same flag), and I need to use that structure because of SEO requirements.
kricir replied on at Permalink Reply
kricir
I have this same scenario happening.

My site goes (missing a few pages of course):

Home -
- English
-- Blog
- Chinese
-- Blog
- Blog Search

I thought the solution would be to move "Blog Search" underneath the English page, but then if I click on a category, it is unable to find the "Blog Search" page, returning a 404 error.

I noticed the category links to a url built through the controller on line 184 & 185:
$searchn = Page::getByPath('/blogsearch');
$this->set('search',Loader::helper('navigation')->getLinkToCollection($searchn));


and I am curious if this has anything to do with it?

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.