The 5.7 branch of Magnolia reached End-of-Life on December 31, 2023, as specified in our End-of-life policy. This means the 5.7 branch is no longer maintained or supported. Please upgrade to the latest Magnolia release. By upgrading, you will get the latest release of Magnolia featuring significant improvements to the author and developer experience. For a successful upgrade, please consult our Magnolia 6.2 documentation. If you need help, please contact info@magnolia-cms.com.

This page provides two examples of how to create minisites:

  • Using a shortened URL to use within an existing domain.
  • Using a sub-domain.


Use case

We have content for a minisite that resides deep in the site hierarchy at /comics/belgian-comics/morris/lucky-luke/jolly-jumper. This page node and its subpages should be served as a minisite.

Assume that there is already a site named site named comics-site, mapped to the domain www.best-comics-net, mapped to the content /comics. This means requesting the domain with no further paths returns the rendered page of the node /comics. (See Multisite example - Two sites with different domains.)

Now we look at two solutions for the jolly-jumper minisite:

Setting up content

The tree below shows the page nodes.

PageTitle

 
comics

Best comics

 
us-comics

US comics

 
belgian-comics

Belgian comics

 
morris

Morris

 
lucky-luke

Lucky Luke

 
jolly-jumper

Jolly Jumper

 
in-love

Jolly Jumper in love

 
family-tree

Jolly Jumper's family tree

In the following examples we look at the page node /comics/belgian-comics/morris/lucky-luke/jolly-jumper and its subpages. 

Shortening the URL with handlePrefix within an existing site definition

Keep in mind that this example assumes that the site definition comics-site already exists. Have a look at the site definition setup in Multisite example - Two sites with different domains.

This is the existing comics-site site definition with an additional node under mappings:

Node nameValue

 
comics-site


 
theme


 
name

comics-theme

 
prototype


 
mappings


 
website


 
URIPrefix


 
handlePrefix

/comics

 
repository

website

 
jolly-jumper


 
URIPrefix

/jollyjumper

 
handlePrefix

/comics/belgian-comics/morris/lucky-luke/jolly-jumper

 
repository

website

 
domains


 
best-comics


 
name

www.best-comics.net

To get a short URL, we add another node under <site>/mappings. In this example, we add the node /comics-site/mappings/jolly-jumper.

jolly-jumperThe mapping node name is arbitrary.
@URIPrefix=/jollyjumperEnables you to access the content at <domain>/jollyjumper
@handlePrefix=/comics/belgian-comics/morris/lucky-luke/jolly-jumperMaps the content node.
@repository=websiteIndicates the JCR workspace of the mapped content.

Now test it: www.best-comics.net/jollyjumper. It works!

Using a new subdomain with a distinct site

In this solution you enable access to the jolly-jumper minisite using the subdomain jollyjumper.best-comics.net.

To do this, you configure a new site definition:

Node nameValue

 
jolly-jumper-site


 
theme


 
name

jolly-jumper-theme

 
mappings


 
website


 
URIPrefix


 
handlePrefix

/comics/belgian-comics/morris/lucky-luke/jolly-jumper

 
repository

website

 
domains


 
jolly-jumper


 
name

jollyjumper.best-comics.net

Note that using a distinct site for the minisite means that you can also apply another theme to it. In this example, the jolly-jumper-site uses the jolly-jumper-theme. The jolly-jumper-theme has a CSS that applies a different font (compared to the the comics-theme on the comics-site).

Extending the existing comic site:

If the new jolly-jumper-site should reuse items defined on the comics-site - for instance i18n and templates - you can define the jolly-jumper-site in a way that it extends the comic-site:

Node nameValue

 
jolly-jumper-site


 
extends

../comics-site

 
domains


 
jolly-jumper


 
name

jollyjumper.best-comics.net

 
extends

override

 
mappings


 
extends

override

 
website


 
URIPrefix


 
handlePrefix

/comics/belgian-comics/morris/lucky-luke/jolly-jumper

 
repository

website

 
theme


 
name

jolly-jumper-theme

Configuring the environment 

 To enable accessing the Magnolia instance with the new subdomain - you must configure your environment accordingly, see mapping multiple domains to the application server.

<VirtualHost *:80>
    ServerName www.best-comics.net
    ProxyPass / ajp://localhost:8010/
    ProxyPassReverse / ajp://localhost:8010/
</VirtualHost>

<VirtualHost *:80>
    ServerName www.best-vinyl.net
	ProxyPass / ajp://localhost:8010/
    ProxyPassReverse / ajp://localhost:8010/
</VirtualHost>

<VirtualHost *:80>
    ServerName jollyjumper.best-comics.net
    ProxyPass / ajp://localhost:8010/
    ProxyPassReverse / ajp://localhost:8010/
</VirtualHost>

Testing

Now try to access jollyjumper.best-comics.net. It works!




  • No labels