How to acess differing content folder in multisite installation?

Hello

I want to setup a multisite installation of three blogs a, b and c, each serving it’s own domain:

  • Blog a gathers and provides all blog postings in a content/blog subdirectory.
  • Blog b and c select the postings dedicated to them and display them on their own domain.

Thus blog b and c do not store their own blogposts, they only display the postings from blog A, which are assigned to them via tagging. This means that with regard to blog postings blog b and c only provide a strict subset of the blog posting stored in blog a’s content/blog folder.

This seemed to be easy to solve using custom folder setup (https://goo.gl/bJNNyE) and tag filtering (https://goo.gl/uLtwn9):

  • I first used the convenient custom folder setup to setup a multisite installation, so that I could differentiate the three domains beneath one root directory.
  • Then I wanted to add templates to blog B and C which select the appropriate tagged content from the content directory of Blog A.

Here I got stuck and ask for helpful ideas:

When I setup a custom folder for Blog B or C using this command

$kirby->roots->content = $kirby->roots()->index() . DS . 'blog_b';

along with this filtering command sitting in a template in blog B or C

$filtered = $page->children()->filterBy('tags', 'blog_b', ',');

the filtering command naturally has only access to it’s own content scope defined by the custom folder assignment and cannot reach out to blog A’s content.

My question is: How I can access a specific content subfolder of a different site in a multisite installation, though I have in general intentionally separated content folders?

One work around would obviously be to provide a link to the specific content folder from blog b and c to the folder in Blog A on the filesystem level. If possible I would prefer a elegant Kirby-style solution to handle this issue :-).

Please apologize in case I have overseen an evident solution!

Many thanks for your support in advance,
dpac

Hello

I still struggle with this requirement and try to reframe it, to make it more understandable:

A. Multisite setup

I have domain_a and domain_b with a classical multisite setup:

-- kirby
-- panel
-- domain_a
   -- assets
   -- content
      -- products
      -- blog
      -- about
   -- site
   -- thumbs
-- domain_b
   -- assets
   -- content
      -- products
      -- blog
      -- about
   -- site
   -- thumbs

Cf. https://getkirby.com/docs/developer-guide/configuration/folders#multi-site-setup.

B. Reach out into other site (exceptional)

My goal is now to fetch content from domain_a/content/blog in the domain_b/content context (to avoid having the same content multiplied):

Operating in the domain_b context I simply changed the content-folder temporarily, so that they point to domain_a:

$kirby->roots->content = “/var/www/virtual/html/domain_a/content”;
$kirby->urls->content = “http://domain.com/domain_a/content/”;

and then fetch the blogposts (still operating in domain_b context) from domain_a:

$articles = page('blog')->children()->visible()->sortBy('date', 'desc');

This results in showing the blog posts from domain_b, not those I wanted to fetch from domain_a!

It seems I have to reinstantiate the Kirby-instance to get the change of the folders become effective?

Many thanks for your support!

dpac

I’d try using a symbolic link:

cd domain_b/content
ln -s ../../domain_a/content/blog ./blog

This way the content will stay in sync while being editable on both panels.

Hi Pedro

Many thanks! This should indeed work fine… :-).

Too simple to be true and I think it will solve my issue at hand … though I cannot have additional blogposts solely in domain_b…

Kind regards,
dpac