Template:SideTOC: Difference between revisions

From 118Wiki
Jump to navigation Jump to search
m (Just adjusting the upper spacing of this page.)
mNo edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><div style="padding: 5px; border: 5px solid white; border-radius: 10px; background-color: {{#if: {{{color|}}} | {{{color}}}; | grey; }}; position: fixed; bottom: 10px; right: 10px; z-index: 100; width: fit-content; max-width: 300px;">
<includeonly>{{#css:
.Side-TOC { display:block; }
 
@media only screen and (max-width: 768px) {
.Side-TOC  { display:none; }
}
}}
<div class="Side-TOC" style="padding: 5px; border: 5px solid white; border-radius: 10px; background-color: {{#if: {{{color|}}} | {{{color}}}; | grey; }}; width: max-content; position: sticky; top: 0;">
<center style="color: white; padding: 5px 0; font-weight: bold;">{{#if: {{{title|}}} | {{{title}}} | {{PAGENAME}} }}</center>__TOC__
<center style="color: white; padding: 5px 0; font-weight: bold;">{{#if: {{{title|}}} | {{{title}}} | {{PAGENAME}} }}</center>__TOC__
</div></includeonly><noinclude>{{SideTOC}}
</div></div></includeonly><noinclude><div style="background-color: #f0f0f0;>
== How to use SideTOC ==
== How to use SideTOC ==
'''SideTOC'''  is just a cute, slightly-customizable, way to produce a Table of Contents that floats in the bottom-right corner of the page it's on. You can set a custom colour for it and customize the title that appears over it. My recommendation is to use it on your Character Pages if you like it. '''''You can see it in-use on this page, down in the bottom right!'''''
'''SideTOC'''  is just a cute, slightly-customizable, way to produce a Table of Contents that floats in the bottom-right corner of the page it's on. You can set a custom colour for it and customize the title that appears over it. My recommendation is to use it on your Character Pages if you like it. '''''You can see it in-use on this page, down in the bottom right!'''''
Line 14: Line 21:
* SideTOC might be awkward / non-functional on mobile devices or older browsers. Consider it's use carefully.
* SideTOC might be awkward / non-functional on mobile devices or older browsers. Consider it's use carefully.
** You may also want to create a secondary "Mobile-Friendly" version of your page by adding "/Mobile" to the page URL. (Up to you!)
** You may also want to create a secondary "Mobile-Friendly" version of your page by adding "/Mobile" to the page URL. (Up to you!)
<templatedata>
{
"params": {
"color": {
"description": "Set a color for your SideTOC.",
"suggestedvalues": [
"steelblue, firebrick, darkgoldenrod, black, green"
],
"default": "grey"
},
"title": {
"description": "Set a custom title for your Side TOC.",
"default": "{{PAGENAME}}"
}
},
"description": "A cute, slightly-customizable, Table of Contents that floats in the bottom-right corner of the page."
}
</templatedata>


=== Changing the Color ===
=== Changing the Color ===
Line 104: Line 130:
What this does is effectively pad the right-side of your page by the WIDTH amount to allow some extra space for the SideTOC not to overlap your page content. If you need some help with this, contact a Wiki Ops member or [[User:Kivik|The creator of this Template]].
What this does is effectively pad the right-side of your page by the WIDTH amount to allow some extra space for the SideTOC not to overlap your page content. If you need some help with this, contact a Wiki Ops member or [[User:Kivik|The creator of this Template]].


=== It's Too Big! === <!-- That's what she said! -->
'''Note''' - This code is in-use on this page, as a demonstration, with a value set to "220px".
 
=== It's Too Big! ===
SideTOC works great for pages with ''few layers of headings''. The more headings and, in particular, ''layers'' of headings you have, the longer and wider it will be. If you want to use SideTOC, you may want to consider paring down the number of headings on your page.
SideTOC works great for pages with ''few layers of headings''. The more headings and, in particular, ''layers'' of headings you have, the longer and wider it will be. If you want to use SideTOC, you may want to consider paring down the number of headings on your page.
</noinclude>
{{SideTOC}}</noinclude>

Latest revision as of 05:54, 27 April 2024

How to use SideTOC

SideTOC is just a cute, slightly-customizable, way to produce a Table of Contents that floats in the bottom-right corner of the page it's on. You can set a custom colour for it and customize the title that appears over it. My recommendation is to use it on your Character Pages if you like it. You can see it in-use on this page, down in the bottom right!

Things to note:

  • SideTOC won't force a TOC to appear if the page doesn't think one is needed (e.g. few headings)
    • It's recommended you only use this template on pages with at least a few headings, otherwise, why bother?
  • SideTOC might not work neatly on all pages, particularly pages with lots of content along the right side of the page
    • If you're finding it's a bit bulky, try paring down the number of headings
  • SideTOC might be awkward / non-functional on mobile devices or older browsers. Consider it's use carefully.
    • You may also want to create a secondary "Mobile-Friendly" version of your page by adding "/Mobile" to the page URL. (Up to you!)

A cute, slightly-customizable, Table of Contents that floats in the bottom-right corner of the page.

Template parameters

ParameterDescriptionTypeStatus
colorcolor

Set a color for your SideTOC.

Suggested values
steelblue, firebrick, darkgoldenrod, black, green
Default
grey
Unknownoptional
titletitle

Set a custom title for your Side TOC.

Default
{{PAGENAME}}
Unknownoptional

Changing the Color

By default, SideTOC will appear in a Grey colour. If you want to set a custom colour, do this:

{{SideTOC|color=YourChoice}}

For Example...

{{SideTOC|color=black}}
{{SideTOC|color=steelblue}}
{{SideTOC|color=#b22222}}

Will generate something like these, respectively:

Black Example
Mock Table of Contents [hide]
  1. Example Table of Contents
  2. Further examples
  3. How many examples?
    1. This many examples
SteelBlue Example
Mock Table of Contents [hide]
  1. Example Table of Contents
  2. Further examples
  3. How many examples?
    1. This many examples
#b22222 Example
Mock Table of Contents [hide]
  1. Example Table of Contents
  2. Further examples
  3. How many examples?
    1. This many examples

Some common colours you might want to consider using, include:

  • steelblue (e.g. science, medical)
  • goldenrod or darkgoldenrod (e.g. security, tactical, engineering, operations)
  • firebrick (e.g. command, intelligence)
  • green (e.g. marines)

If you want to use a hex value (e.g. #FFFFFF / #000000) you can also use that instead.

Changing the Title

By default, SideTOC will use the Page Name as its title. If you want to set a custom title (e.g. if the Page Name is long or awkward), do this:

{{SideTOC|title=YourChoice}}

For example...

{{SideTOC|title=Custom Title}}
{{SideTOC|title=Blue Custom Title|color=steelblue}}

Will generate something like these, respectively:

Custom Title
Mock Table of Contents [hide]
  1. Example Table of Contents
  2. Further examples
  3. How many examples?
    1. This many examples
Blue Custom Title
Mock Table of Contents [hide]
  1. Example Table of Contents
  2. Further examples
  3. How many examples?
    1. This many examples

Overlapping Content?

Here's a recommendation on what to do if your SideTOC is overlapping content and you don't like that. Add the following code to the top of your page, right under your SideToc element:

<div style="margin-right: WIDTH;">

Replacing the "WIDTH" parameter with the approximate width of your SideTOC. If you're familiar with browser developer tools, you can likely calculate this exactly, but it'll probably be something around "150px" to "200px" and won't be more than "300px", as that is the maximum width set in the SideTOC template. You can also theoretically use %s here, rather than pixels, but that's not recommended.

What this does is effectively pad the right-side of your page by the WIDTH amount to allow some extra space for the SideTOC not to overlap your page content. If you need some help with this, contact a Wiki Ops member or The creator of this Template.

Note - This code is in-use on this page, as a demonstration, with a value set to "220px".

It's Too Big!

SideTOC works great for pages with few layers of headings. The more headings and, in particular, layers of headings you have, the longer and wider it will be. If you want to use SideTOC, you may want to consider paring down the number of headings on your page.