How do I remove the footer in MediaWiki? - html

I am trying to remove the footer in my MediaWiki installation
"This page was last modified..."
Number of views
Privacy policy link
MediaWiki image
I am using the Vector theme.
The instructions on the MediaWiki site don't seem to match the Vector theme, which appears to be the default one.
I can't find any of the $wg elements mentioned on the MediaWiki site (such as $wgHooks and $wgMaxCredits) in the Vector theme itself. So how can I modify the theme to remove the footer elements?
Any help or advice would be much appreciated. I am sure I am missing some part of the MediaWiki site, but can't seem to find it.

I'm not sure why you want to do that, but here are some thoughts:
The "This page was last modified..." message is constructed with the Lastmodifiedat interface message. So, if you edit MediaWiki:Lastmodifiedat in your wiki and remove any contents, the footer element will be empty (even if the li-element is still there!).
The number of views was removed in MediaWiki 1.25, so i suggest you upgrade your wiki and the count will be away automatically ;) If you don't want to upgrade or can't (for whatever reason) you can set $wgDisableCounters = false; in your LocalSettings.php.
The privacy, about and disclaimer link can be removed by replacing the appropriate interface messages with a dash "-". Just edit these pages on your wiki:
MediaWiki:Privacy
MediaWiki:Aboutsite
MediaWiki:Disclaimers
To remove the MediaWiki image, you just need to set this line in your LocalSettings.php:
$wgFooterIcons['poweredby'] = array();
Btw.: You don't see most of the variables and interface messages in the Vector skin, because the footer is mostly generated in MediaWiki itself and the Skin simply handels how it is displayed, not what is displayed.

You can use CSS to remove the footer for any theme or skin: there is a common CSS file built into the MediaWiki database behind each wiki:
http://<your-site>/wiki/index.php/MediaWiki:Common.css
Enter that link in your browser to go that page. Then click the "Edit" link to edit that page and add this line to the page:
#footer { display: none; }
NOTE: You may not want to remove the entire footer. You can remove individual components by entering them in the WikiMedia:Common.css instead:
/* last modification stuff */
#footer-info { display: none; }
/* footer links */
#footer-places { display: none; }
/* powered by icon */
#footer-icon { display: none; }
Personally, I would keep the footer-icon which contains the Powered by MediaWiki icon, and give credit where it is due.
If you are working with the MobileFrontend extension then you will also need to add the same lines to:
http://<your-site>/wiki/index.php/MediaWiki:Mobile.css
Do you want to remove the WikiMedia footer or just change it?
I can see wanting to remove parts of the default footer like the last modification string. You can use CSS to hide it as I mentioned above or you can enter this URL into your browser:
http://<your-site>/wiki/index.php/MediaWiki:Lastmodifiedat
Edit that page and remove the line that's there, then save the page. The last modification stuff will disappear from your wiki pages.
But the footer links section can be very useful. If you want to CHANGE the footer links, there is a hook (SkinTemplateOutputPageBeforeExec) provided in the MediaWiki docs:
https://www.mediawiki.org/wiki/Manual%3AFooter#Add_links_to_the_footer
If you want to REMOVE the existing footer links and ADD YOUR OWN new footer links, follow the instructions in the embedded comments and then add this PHP code to your LocalSettings.php file:
# Remove all existing footer links and add my own
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) {
# IMPORTANT: this is the secret sauce - remove all existing footer links
$tpl->data['footerlinks']['places'] = array();
# To add new footer links to local wiki pages:
#
# 1) You MUST create your new pages in your (Main) namespace first, for example:
#
# http://<your-site>/wiki/index.php/About_Us
# http://<your-site>/wiki/index.php/Contact_Us
# http://<your-site>/wiki/index.php/Disclaimer
# http://<your-site>/wiki/index.php/Download
# http://<your-site>/wiki/index.php/Privacy_Policy
#
# 2) You MUST then create each of these pages in your MediaWiki namespace:
#
# http://<your-site>/wiki/index.php/MediaWiki:Aboutpage
# - Insert 1 line, with "About Us" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Contactpage
# - Insert 1 line, with "Contact Us" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Disclaimerpage
# - Insert 1 line, with "Disclaimer" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Downloadpage
# - Insert 1 line, with "Download" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Privacypage
# - Insert 1 line, with "Privacy Policy" (no quotes)
#
# 3) Add new footer links like this:
$tpl->set( 'aboutpage', $sk->footerLink( 'aboutpage', 'aboutpage' ) );
$tpl->data['footerlinks']['places'][] = 'aboutpage';
$tpl->set( 'contactpage', $sk->footerLink( 'contactpage', 'contactpage' ) );
$tpl->data['footerlinks']['places'][] = 'contactpage';
$tpl->set( 'disclaimerpage', $sk->footerLink( 'disclaimerpage', 'disclaimerpage' ) );
$tpl->data['footerlinks']['places'][] = 'disclaimerpage';
$tpl->set( 'downloadpage', $sk->footerLink( 'downloadpage', 'downloadpage' ) );
$tpl->data['footerlinks']['places'][] = 'downloadpage';
$tpl->set( 'privacypage', $sk->footerLink( 'privacypage', 'privacypage' ) );
$tpl->data['footerlinks']['places'][] = 'privacypage';
return true;
};
IMPORTANT: Don't forget to follow the instructions and create your own pages and the corresponding MediaWiki redirects, or your links may not show or they may be broken.

Related

Show header permalink on hover (pelican)

How do I get a clickable "permalink" to show on hover (for e.g. h2 headers) similar to this.
I'm using the pelican framework and am writing in restructuredText. I can't figure out where in the stack to tweak to enable this (pelican? rst? jinja2?)
It's called a label. Usage is documented under the ref role.
To support cross-referencing to arbitrary locations in any document, the standard reST labels are used. For this to work label names must be unique throughout the entire documentation. There are two ways in which you can refer to labels:
If you place a label directly before a section title, you can reference to it with :ref:label-name. For example:
.. _my-reference-label:
Section to cross-reference
--------------------------
This is the text of the section.
It refers to the section itself, see :ref:`my-reference-label`.
Edit
For Pelican, there is a plugin called headerid that will render permalinks.
You can get that through the options of the Markdown TOC extension.
Just set the permalink option to True in your pelicanconf.py:
MARKDOWN = {
'extension_configs': {
'markdown.extensions.toc': {'permalink': 'True'}
}
}

Change title of Keycloak login

I want to know how to change title on login page via Keycloak?
The easiest way is to change the following line in themes/base/login/messages/messages_[your_language].properties.
loginTitle=Log in to {0}
However, I suggest you should read the official document and create your original theme.
You can change to themes[your theme]\login\resources\css\login.css
You can add like this
/* Title */
#kc-page-title::after {
content: " to MyHomeLogin"
}
I suggest the following if you are working with a custom theme.
Go to themes/base/login.
Copy the file template.ftl
Go to themes/custom/login -> 'custom' or the name of your theme
Paste the template.ftl file there
Open template.ftl
Search for the element
Replace the content with your desired text
Save it and reload the page
I prefer this method because it only overwrites the base theme at runtime without making any changes to the base theme directly. Thanks.

How to change the location of the TOC in a MediaWiki skin

I'm woking on a MediaWiki skin for my site. For the page content I'm using <?= $this->html( 'bodycontent' ); ?> to output it all. Part of this, on longer pages, is the Table of Contents (TOC).
I would like to move the location of the TOC out of the body an into the sidebar but I'm not sure how to prevent the TOC from showing in the bodycontent or where to get the raw data to display it in the sidebar.
I'm hoping there is a data time similar to $this->data['sidebar']['navigation'] that I can use to format it how I want.
How can I turn off the TOC in the bodycontent?
Is there a $this->data location that has the TOC data?
The MediaWiki skinning system is not really designed for this, but someone created an extension to make your work easier: https://www.mediawiki.org/wiki/Extension:DeToc
Using that extension you would do something like this (inside function execute()):
$body = $this->data['bodycontent'];
$new_body = DeToc::RemoveToc($body, $extracted_toc);
/* Print body */
echo $new_body;
/* Print TOC somewhere else */
echo $extracted_toc;
Alternatively you could just turn off the TOC, using $parser->mShowToc = false;, and then create the TOC yourself. MediaWiki internally uses a regex like this to find all sections: '/^\={2,5}(.*?)\={2,5}$/m'

More columns in Typo3 7.2 (Bootstrap)

I need to make a 4 column website with Bootstrap but in typo3 the default setting is to have 2 cols max. To be able to edit each column in backend I have created a layout following this tutorial: http://blog.sebastiaandejonge.com/articles/2012/july/26/implementing-typo3s-backend-layouts/
I cannot display content of the columns on frontend though.
In the template section for a page that uses this layout I have added
agptop1 < styles.content.get
agptop1.select.where = colPos = 20
agptop2 < styles.content.get
agptop2.select.where = colPos = 21
etc which are the positions set in the layout manager.
Now I should specify the variable like agptop1 so I created a template file among the other bootstrap templates in typo3conf\ext\bootstrap_package\Resources\Private\Templates\Page
It is a copy of the default template with some things changed like...
<f:layout name="Default"/>
<f:section name="Main">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: '{data.uid}', colPos: '3'}"/>
<div class="container">
<div class="row">
<div class="col-sm-3">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: '{data.uid}', colPos: '20'}"/>
<f:format.raw>{agptop1}</f:format.raw>
</div>
...like the line
<f:format.raw>
and the colPos. I suppose this is correct? I have found this somewhere here on SO.
But when I use this as a template directly in template editor of the page I need it for I only get blank page.
I cannot find out how are the default bootstrap templates linked to the Default.html and to manu configuration and how is this all linked to Backend Layout. I need to pick a backend layout, fill in the content, then something1 must tell something2 that I want to load standart page, standart menu but a specific template with the variables defined. How can this be done?
I'm sorry if it's too basic but it's my first day in typo3 and there is no manual for the new version.
The spaces on colPos = 20 are a problem in Typoscript. Using this should help:
agptop1.select.where = colPos=20
From your answer I assume, that your are using the plugin bootstrap_package. This plugin comes with some new predefined templates and you want to add one more, right?
Step 1 adding a new backendlayout
To add another option to your backend page-options, have a look into
BackendLayouts
Each file contains the description of one backend layout and each file is built the same way:
1. Defining a title (no need of using a language file here)
2. Defining the alignment (rows cols) of the content-container in the backend
3. Defining a icon
Just copy one of these files and modify it. These files have to be included in the page-layout and bootstrap_package does it automatically when it is installed. You can turn of this behaviour in the extension setting and include all backend layouts by your own. Therefor copy the file BackendLayouts.txt from bootstrap_package to your fileadmin, add your custom new layout and include the file in you pagets-config like so:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/template/typoscript/BackendLayouts.txt">
Note 1: For single files use 'FILE:' for Directories use 'DIR:'
Note 2: For pagets-config go to your root-page, edit it, got to resources and scroll down. Here it is. Enter code here.
If you have done it right you could now select your new layout from backend.
Step 2 Creating your own template
Copy one of the bootstrap_package template files and modify it, by only adding new cObject elements and what you need for your alignment.
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: '{data.uid}', colPos: '2'}"/>
In addition copy the hole dir /typo3conf/ext/bootstrap_package/Resources/Private to the fileadmin and put your own template in the subdir 'Templates'
Step 3 Bring it together
As the last step you have to modify the typoscript-setup. I recommend to copy the bootstrap setup-files and include it manually rather then import it by static template.
So remove your static template "Boostrap Package (bootstrap_package)" copy the setup.txt and constant.txt from
/typo3conf/ext/bootstrap_package/Configuration/TypoScript/
to your fileadmin dir and include it like so:
Constants:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/template/typoscript/constants.txt">
Setup:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/template/typoscript/setup.txt">
After all you have to open your custom constant.txt file and add your own paths:
page {
...
fluidtemplate {
# cat=bootstrap package: advanced/100/100; type=string; label=Layout Root Path: Path to layouts
layoutRootPath = fileadmin/template/Private/Layouts/Page/
# cat=bootstrap package: advanced/100/110; type=string; label=Partial Root Path: Path to partials
partialRootPath = fileadmin/template/Private/Partials/Page/
# cat=bootstrap package: advanced/100/120; type=string; label=Template Root Path: Path to templates
templateRootPath = fileadmin/template/Private/Templates/Page/
}
...
}
And for the last step add your new template in the config.txt into the fluidtemplate-part 'page.10.templateName ...' doing some pattern-matching =)
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
pagets__default_clean = TEXT
pagets__default_clean.value = DefaultClean
pagets__default_2_columns = TEXT
pagets__default_2_columns.value = Default2Columns
...
I hope, that i have described everything important. If you have trouble, have deep look into bootrack_package's source code. You can learn everything by miming what they have done.
Good luck

In Pelican, how to create a page dedicated to hosting all the blog articles?

In pelican, by default, blog articles are listed on the index.html file.
What I want instead is that I use a static page as my home page and put all the blog articles on a dedicated "Blog" page.
How can I get this done?
While there are several possible methods for achieving your desired goals, I would start with the following changes to your settings file:
SITEURL = '/blog'
OUTPUT_PATH = 'output/blog'
PAGE_URL = '../{slug}.html'
PAGE_SAVE_AS = '../{slug}.html'
DISPLAY_PAGES_ON_MENU = False
DISPLAY_CATEGORIES_ON_MENU = False
MENUITEMS = [('Home', '/'), ('Blog', '/blog/')]
Put your blog posts in content/ as usual, and then create your home page with the following headers and save as content/pages/home.md:
Title: Home
URL: ../
Save_as: ../index.html
This is the home page.
Caveats:
Dynamic navigation menu generation has been effectively turned off since it doesn't work well with this configuration. Highlighting for the currently-active menu item — a feature you normally get out-of-the-box — will not be present in this configuration and, if desired, must be implemented separately in your theme.
If your theme's base.html template has a link to your site home that depends on SITEURL (e.g., as the notmyidea theme does), you will need to change the link to point to <a href="/"> instead.
Set the following in the pelicanconf
DIRECT_TEMPLATES = ['blog']
PAGINATED_DIRECT_TEMPLATES = ['blog']
1st line will set blog.html for the articles
2nd line will allow pagination of blog.html file
For the index page, create a pages folder in the content directory and create the .md file there and set save_as:index.html this will save the md file as index.html
This is covered in the Pelican FAQ
- "How can I override the generated URL of a specific page or article?"
Basically, in your contents folder, create two subfolders:
/contents/blogs, which will store all your blog entries
/content/pages, which will store your other static pages (including your home page)
In the pages subfolder, create a file (e.g. home.rst) with the option :save_as: index.html, which will make this file your home page. E.g.:
Home
####
:date: 2015-05-22 12:30
:url:
:save_as: index.html
This is my home page
In your pelicanconf.py file, specify the following options:
DISPLAY_PAGES_ON_MENU = False
DISPLAY_CATEGORIES_ON_MENU = True
USE_FOLDER_AS_CATEGORY = True
PATH = 'content'
ARTICLE_PATHS = ['articles',]
PAGE_PATHS = ['pages',]
MENUITEMS = ()
You should now have a home page and a contents bar with a Blogs menu.
If you want to add more menus to the contents bar (for example an About or CV menu), create the corresponding files in your pages folder, and add them to MENUITEMS:
MENUITEMS = (
('About', '/pages/about.html'),
('CV', '/pages/cv.html'),
)
I have an answer similar to the one Justin Mayer gave, except in mine I change blog article urls instead of page urls.
I've been getting the following error when trying to use the answer above, so it might be useful to other people having the same issue
ERROR: Skipping volunteering.rst: file '../volunteering.html' would be written outside output path
ERROR: Skipping presentations.rst: file '../presentations.html' would be written outside output path
Make all article urls to be under 'blog/' url
ARTICLE_URL = "blog/{date:%Y}-{date:%m}-{date:%d}-{slug}.html"
ARTICLE_SAVE_AS = "blog/{date:%Y}-{date:%m}-{date:%d}-{slug}.html"
Put blog index under 'blog/' url
INDEX_SAVE_AS = "blog/index.html"
Add a explicit menu item for blog index
MENUITEMS = [
('home', '/'),
('blog', '/blog'),
]
As your page is now an index page, automatically displaying link to that page in the menu will lead to a broken link, so you will have to set the following option and specify the following flag
DISPLAY_PAGES_ON_MENU = False
For the new index page, add a directive save_as, like Justin Mayer pointed it out. Here how it looks in rst
About
=====
:slug: about
:category: About
:save_as: index.html
This should give you a home page and an index page for articles.
When you want to add more static pages, you will also need to add them in menu items that still contains '/pages' prefix in the url if you want links to the pages appear in a menu. i.e for the volunteering.rst with the following content,
Volunteering
============
:slug: about
:category: About
Your MENUITEMS variable will look like the following
MENUITEMS = [
('home', '/'),
('blog', '/blog'),
('volunteering', '/pages/volunteering'),
]
I tested this answer on pelican 4.2.0.
You can use the following settings to put the index file for example at /blog/index.html.
INDEX_SAVE_AS = 'blog/index.html'
INDEX_URL = 'blog/'
Then you created a home.md page and use "save_as: index.html" directive for the actual home page.