Comrade:CriticalResist/sandbox/Portal documentation

Portals rely on three templates:

And their associate style.css subpages for each. They should be called in this order (as seen above in the bullet list) on a portal page.

Look at our prototype portal: Marxism and open the source editor to see how it's structured.

How a portal is structured

Before we go into what each template does, we need to look at how a portal is structured.

First you call Portal CSS without parameters.

Then create a div with the portal class:

<div class="portal">Banner and containers go in here</div>

Then you call Portal Banner once. Then you call Portal containers as you like. Containers is where it's at as you call Portal CSS once, then Portal Banner once, and then use Portal Containers to fill in the actual content.

The niftiest part of containers is their column system which is taken from bootstrap (The CSS and JS framework). You have to imagine the page is divided in 12 equal-size columns and you tell each container to take between 1 and 12 columns in size. It's a bit complicated to understand but basically you can have 2 containers side by side if you tell them width=6 (in this case width is a parameter for the template, not the CSS width declaration).

If you give three containers a 4 width, they will each take up 4+4+4 columns = all 12.

This is very flexible. You don't need to take up all 12 columns, you can also have one container take up 6 and then the next one take up 7, but this will center them on their own row and create two rows as they can't fit side by side.

You can also have three containers like so: 3+6+3=12.

Anyway experiment with the column system, it's pretty cool.

On mobile, containers all take up the 12 columns (width:100%).

Nesting containers

You can nest containers inside each other by simply calling the template inside the template, like so:

{{Portal container|content=<div class="portal">{{Portal container|content=xyz}}</div> }}

In other words you can call templates inside templates and even other stuff like HTML code, modules, wikicode, whatever you like. Nothing is off-limits.

If you nest containers, you will need to re-add a <div class="portal"> however so that the nested containers are flex-boxed. If this doesn't make sense, just follow the preformatted code above.

Templates

Portal CSS

Just sets up the general CSS for the entire page. It makes .portal (the parent container) display as a flexbox for both desktop and mobile and also removes some styling surrounding h2 and h3 headers that is good to have on wiki pages but not on the portal system. Technically we could move this css to another template (because as long as one template is called it will call its CSS on the entire page output, which is the body of the page we can edit as users) but I figure sooner or later we'll need a dedicated CSS page.

Just like I did for the library I think at some point we might move all CSS into this template to avoid calling it more than once.

Portal banner

Banner takes the following parameters:

  • image: the image you want to use for the banner background
  • title: title you want to display on the banner, will also set the DISPLAYTITLE to this
  • title color: you can change the title color just in case. I would recommend using either white or black. You can use any CSS/HTML color method here (hexa, rgb, etc).

You only call the banner once and at the very top of the page, AFTER all of this:

{{Portal CSS}}
<div class="portal">
 {{Portal banner|image=Marx_and_Engels_1848.png|title=Marxism portal|title color=white}}
/*Call your containers here*/
</div>

Portal containers

I already talked about the containers and how to use them, here we'll talk about their parameters.

  • width: from 1 to 12, the number of columns the container takes (12=100%, full width)
  • border: if "no", will remove the border around the container. Useful for aesthetic layouting and for including nested containers
  • content: this is where the content of the container will go. Again, you can use anything you like inside this parameter: call another template, call a module, include wikicode, and even HTML!

I would recommend you structure your containers like this in the code just to make reading easier:

{{Portal container|width=12|border=no
 |content= Hello}}

This just makes it easier to read for other editors when we have lots of containers in a portal. Width and border parameters go on same line as the template call, then content goes on its own line.

Also remember you can add comments like this: '