I'd like to add a simple warning directive at the top of every page on a Sphinx RTD site:
.. attention::
The next major release of this project will launch on X date.
In the meantime, we're looking for feedback.
If you'd like an early preview, please reach out at someemail#someaddress.com!
What's the simplest way to do this? I'm using the sphinx_rtd_theme.
I can see how to add a block using the extrabody block, but it appears outside the main content area and is positioned and styled totally independently.
Ideally, I'd want this block to show up at an attention directive just below the breadcrumbs on every page.
You could add this to the conf.py Sphinx configuration file:
rst_prolog = """.. attention::
The next major release is imminent.
"""
and it will be included at the beginning of every source file that is read ‒ see https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-rst_prolog.
F-string literals work too, so f'This is release #{release}' will substitute that variable value.
I want to access my website front page via aliases: http://mysite.com/some_alias_one and http://mysite.com/some_alias_two. Later I want to take some_alias_one(as well as some_alias_two) parameter in code and proceed further actions with it. In this case I do not need any redirection. If visitor comes with alias http://mysite.com/some_alias_one, so he must stay in home page with this alias without redirection. So then in my code I will check is user using alias_one or alias_two and depending to it I will do further actions (for example show some text or modules and etc).
So any ideas?
If I am understanding you correctly, there is a somewhat simple answer. Simply make 2 menu items that point to the same thing with different aliases. Since the menu items have different aliases, they will have different item IDs and you can assign different modules to each one. You can customize each page based on the modules you add to the page.
The only issue you will have is when a use goes to http://mysite.com - you will need to create a redirect that sends the user to one of the 2 aliases you have created. Either that or one of the 2 menu items will need to be set as the default.
there are tutorials on the web about gow to create index.html, css file and template.xml that contain placeholders. ok, i got it, it's simple. but i need a template that has some different views. for example:
-all pages have a topmenu, header, left sidebar, mainarea and a footer but:
-first page has no header .topmenu after which sidebar, mainarea and footer comes.
-second page has sidebar moved from left to right
-third page has four blocks (blocks for special offers) instead of mainarea.
as far as i can see, i need to create three standalone templates with unique set of placeholders for each template. because i can't see the way to change laarge mainarea placeholder with four placeholders for offers blocks on some pages. dynamically.
is there if-statements in joomla templates to simply determine a document id to view four placeholders instead of mainarea. or to not show header on the main page (f.e. doc. id="mainpage")
but i want it to be selectable like:
-this page has first case of that template (index_1.php)
-and that page has a second case of the same template (index_2.php)
like a selectbox.
is that possible?
I will make this an answer as opposed to a comment since I believe it will do what you are looking for.
Once your articles are setup and your links to them are established (the site has the info on it you're looking for), you can create the modules containing the data that you want shown from time to time.
Go to the module manager - on the right you should see 'module assignment' or something along the lines of 'display this module on the following pages'; you can then pick which pages you want the module to show on. You can specify all pages, none, specific pages, however you want.
This will enable you to show them only where needed however you like.
You can ALSO do this programatically inside the module (if you do custom HTML and use an extension like Sourcerer to add PHP to the module) with PHP should you want a little more flexibility, but just choosing the pages to show on should work for what you're doing.
I have a problem with my MediaWiki installation on a local network. I'm using MediaWiki in German. There are several footer links in my wiki, that throw a 404 error. For example in the footer there's a link Impressum (in English: Disclaimer). It points to *NameOfMyWiki*:Impressum which does not exist.
When I go to MediaWiki:Disclaimers, then a Disclaimer shows up, it's the page that should be behind *wgSitename*:Impressum. I don't think it's intended that I have to point the disclaimer link to MediaWiki:Disclaimers.
Another behaviour that probably is based on the same problem is, that a user gets a 404 on his own user page, when the user page is still empty/not already created (clicking on the link on the top right next to settings). When another user edits the user page of the first user, the first user then can access and edit it, too. But not when it's still empty/not defined.
How can I fix that?
The text of the footer links comes from the interface messages MediaWiki:Privacy, MediaWiki:Aboutsite and MediaWiki:Disclaimers. To disable one or more of these links, set the corresponding link text to a single hyphen (-).
Alternatively, since MediaWiki 1.17, you can also modify the footer by defining a hook in your LocalSettings.php.
Ps. For anyone interested in going to all the way to the source, the code that handles these links is in the Skin::footerLink() method. The practice of disabling various interface features by setting the corresponding message to - is actually pretty common (though not universal) in MediaWiki; completely blank messages are treated a bit weirdly for historical reasons, so - is commonly used as a stand-in for "no value".
Edit: I just noticed that you were also asking a second question about user pages. To answer that question better, let me start by describing how MediaWiki should be treating non-existent pages:
When MediaWiki sees a wikilink (most, though not necessarily all, links in the navigation menus are also handled the same way) pointing to a non-existent page, it creates what is known as a redlink. These links are styled differently from normal links (typically they're colored red, hence the name) and point to an URL that looks something like this one, with the parameters action=edit (making it a special kind of edit link) and redlink=1.
When a user clicks such a link, MediaWiki first checks that the page hasn't been created in the mean time, and, if it hasn't been, that the user is allowed to create and edit it:
If the page exists, the user is just redirected to the normal view URL for the page.
If the page doesn't exist, and the user is not allowed to create it, they're also redirected to the normal view URL, which then returns an HTTP 404 status code and a message saying that the page does not exist. (This is what will happen if you click the "like this one" link above, unless you happen to be an admin on Wikipedia.)
Finally, if the page doesn't exist but the user is allowed to create it, MediaWiki just treats the URL like a normal edit link and shows the edit form.
It looks like, for some reason, new users clicking the link to their own user page on your wiki are hitting case 2 above instead of the expected case 3. This might be a user rights issue: in particular, you should check that normal logged-in users (group user) on your wiki have the createpage permission.
If you want to allow normal users to create only their own user pages, there are ways to do that, but all that I know of involve either installing an extension or writing your own getUserPermissionsErrors hook. I can give you some examples of how to do that if you want, but it takes a bit of coding.
Those links are placeholders that you might want to fill in. They are provided so you can easily fill-in some important parts of your new wiki.
See http://www.mediawiki.org/wiki/Manual:Footer for a complete list.
There is actually no setting to disable them.
The link mentioned by Ilmari Karonen above:
Alternatively, since MediaWiki 1.17, you can also modify the footer by
defining a hook in your LocalSettings.php.
...shows how to add links to the built-in list of footer links. What it does NOT show is how to remove the existing built-in footer links, which is what the original question was.
Turns out it is a simple addition to the referenced hook solution. You just need to discard the existing footer links in the template array.
Most folks will not only want to remove the built-in footer links but also add their own. In the spirit of StackOverflow, here is a complete example solution that does both (this is from an existing Wiki...)
This works in mediawiki-1.29.2 but it will probably work in many older versions too. Put this code in your LocalSettings.php file (I put it at the bottom) to remove the existing footer links and add your own:
# 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.
So I have a website that has just two pages. On the home page, there are some things going on, but are not important. There are some links, however, that will need to link to a specific piece of content on the second page.
On the second page, I have content on there and it's all encased in the jcycle plugin.
What I need to do is if someone is on the homepage and they click on a link, it needs to load up the second page and show the correct "slide" that corresponds to what the homepage link is.
If you need any more clarification, please let me know.
In the cycle options reference, I see that there is a startingSlide option. You could set that dynamically. You could either do it with server-side code, e.g. /foo?slide=3 or you could check which anchor reference was used on the incoming link, e.g. /foo#slide3. Or, you could use DHTML to build the slideshow on the homepage when they click the given link.
Also note that there is a slideExpr option that you could use to filter the slides to a smaller set, depending on what they selected.