Links-Talk

I put the following line in what I think is a clean URLs/utf-8 based wiki: https://en.wikipedia.org/wiki/Renée_Jeanne_Falconetti. But when I click on the link it goes to https://en.wikipedia.org/wiki/Ren%E9e_Jeanne_Falconetti instead. The link works properly in pmwiki.org. What might be going wrong? -- RandyB September 22, 2019, at 10:56 PM

Make sure UTF-8 is enabled, and the skin template doesn't have a <meta ...charset=iso8859-1...> directive -- in Firefox you can right-click, select "View Page Info" then look at the line "Text Encoding". The character "é" is encoded differently in Latin-1 and in UTF-8: if both your wiki and the target website use the same encoding/charset, you may be able to link to URLs containing international characters, otherwise, or to make sure, link to the correctly encoded URL which encodes "é" as "%c3%a9". Both Firefox and Chrome copy the correctly encoded URL when you copy the URL from the address bar on that page (not sure about Safari). I thought about adding this feature to FixURL but we cannot assume all external websites are in UTF-8. --Petko September 23, 2019, at 06:30 AM


I am trying to make %target=_blank% the default. How do I do this? --Sveta, 2019-07-14

For most external links, set in config.php:
$UrlLinkFmt = "<a target='_blank' class='urllink' href='\$LinkUrl' title='\$LinkAlt' rel='nofollow'>\$LinkText</a>";
For internal links set $LinkPageExistsFmt, $LinkPageCreateFmt, $LinkPageCreateSpaceFmt, $LinkPageSelfFmt, $LinkCategoryFmt and $LinkUploadCreateFmt. For InterMap links, only if you have custom ones like $IMapLinkFmt['https:'] or $IMapLinkFmt['Attach:']. You define them in config.php and PmWiki will use your values instead of the default ones. Note that there will not be a way to undo this from a wiki page, i.e. %target=_self% will not work. --Petko July 14, 2019, at 07:17 AM


I am trying to change the appearance of the text of a link,
but I find what looks like inconsistencies to me:

   

>>green<<
[[Some Link]]
>><<                                           --> doesn't work

%green% [[Some Link]] %%                       --> works!

>>green<<
[[!Some Category]]
>><<                                           --> doesn't work

%green% [[!Some Category]] %%                  --> works!



>>text-decoration=overline<< 
[[Some Link]] 
>><<                                           --> works!

%text-decoration=overline%  [[Some Link]] %%   --> works!

>>text-decoration=overline<< 
[[!Some Category]] 
>><<                                               --> works!

%text-decoration=overline%  [[!Some Category]] %%  --> works!



>>text-decoration=none<< 
[[Some Link]] 
>><<                                           --> doesn't work

%text-decoration=none%  [[Some Link]] %%       --> doesn't work

>>text-decoration=none<< 
[[!Some Category]] 
>><<                                           --> doesn't work

%text-decoration=none%  [[!Some Category]] %%  --> doesn't work

In particular, I want to have a " [[!Category]] " that is displayed according to something like the following...

>> text-align=left font-family=monospace font-size=larger 
letter-spacing=0.15em font-style=italic  font-weight=bold 
maroon text-decoration="none" <<

Basically, it is meant to be a category, and a banner.
If it can not be a category, a link to the category would also do.
I am trying to avoid the complication of an image banner (different screen sizes, desktops or mobiles, etc).
nikos? June 07, 2019, at 09:43 PM

Category links usually have the CSS class "categorylink" (unless the skin or some other local customization modifies $LinkCategoryFmt). So, in your file pub/css/local.css add the styles you need like a.categorylink { color:maroon; text-decoration:none; }. About the perceived inconsistency, >>WikiStyles<< apply to the text in the whole <div> block, and %WikiStyles% apply up to the next %%, %OtherStyle% or line break, like a <span> element in HTML; as links are usually styled differently from the regular text, the %WikiStyle% feature will also try to set color (only) into links, the <a> element. This is inconsistent with the standard behavior of <span>...<a>..</a>...</span> but appears to be what people wanted at some point so Pm added it. --Petko June 08, 2019, at 05:51 AM


I am changing a domain. Dozens of links in various places in my wiki have full links to pages in the old domain. How can I fix all those? Is there something in the local/config I can set?

You can create a custom markup rule for pages that have not yet been modified, and one or more entries in $ROEPatterns to rewrite the URLs when you open a page for editing. For example, replacing all "http://www.pmwiki.com" with "https://www.pmwiki.org":
Markup('rewrite-pmwiki.com', '<links',
  '/http:\\/\\/www\\.pmwiki\\.com\\//i', 'https://www.pmwiki.org/');
$ROEPatterns['/http:\\/\\/www\\.pmwiki\\.com\\//i']
  = 'https://www.pmwiki.org/';
This will only rewrite links that start with http://, note that the '/URL_patterns/i' start with '/', end with '/i', and inside all dots and slashes are preceded by a double backslash. If provide the actual URLs we can write the actual patterns. --Petko January 14, 2019, at 08:16 PM

I have a combination of headings and nested lists. How do I change the format of list items and headings that are links without changing the non-heading link formatting? I have the following:

!!linkonetext
*linktwotext
**linkthreetext

I want linkonetext to be in heading 2 format, including heading 2 color, but underlined to show it's a link and blue when you mouse over it. (Currently it shows up in heading 2 format but with link text color and underline.)

I want linktwotext to use the heading 3 color and font size, but underlined to show it's a link and blue when you mouse over it. (Currently I can either have it in a list or have it use heading 3 formatting for the text, but not both, and neither one lets me customize the text color for the link based on what level of the list the link is at.)

I want linkthreetext to be in the default link format including text color and underline.

If I use the standard double-square-bracket markup to generate the links, I don't know what to change in the skin or the .php file so that the correct elements incorporate both the link, the list, and the heading formatting. Once I know where to look, I am happy modifying .css and .php files so that the editors don't need to learn new markup.

You can set your styles in your file pub/css/local.css (if it doesn't exist, create it). For example:

/* links in headings */
h2 a, h3 a { color: black; text-decoration: none; }
h2 a:hover, h3 a:hover { color: blue; text-decoration: underline; }

h3 a and h3 a:hover will be applied if you have the link in a !!!h3 heading.

/* links in first level bulleted lists */
ul > li > a { color: black; text-decoration: none; }
ul > li > a:hover { color: blue; text-decoration: underline; }

/* links in second level bulleted lists */
ul > li > ul > li > a,
ul > li > ul > li > a:hover { color: blue; text-decoration: underline; }

Search for a "CSS tutorial" to learn the basics of styles. It is very powerful way to apply styles to your elements, and you're lucky that today most browsers support it consistently, so you only need to learn and write once (unlike a decade ago). And CSS is fun too. Then you'll more easily/clearly understand WikiStyles (a related, but different beast). --Petko March 27, 2016, at 01:19 PM

How do I prevent pmwiki from automatically changing text into a link. e.g. I want this to appear as text, not a link: someone@somedomain.com

See my the second yellow section on this page for an example: http://ahk.refurbituk.com/index.php/Site/Tutorial

You can wrap the address in the "escape" characters [@link@] or [=link=]:

  http://ahk.refurbituk.com/

How can I open an external link in the SAME window (adding %target=_self% doesn't work)?

You shouldn't need to add anything, normally external links open in the same window. If not, check if you don't have set a custom $UrlLinkFmt variable (which shouldn't contain target='_blank').

  • Interesting. I have an external link set up in the sidebar and when I go to the wiki and click it behaves as you say but after I edit the side bar (don't change anything or even save just click cancel) it then adds the external link icon to the link and opens it in a new window! Refreshing doesn't revert it. The only way to 'reset' it is to enter wiki from the link on another page. Very odd but not overly inconvenient. Weird that the external link icon disappears too. I've done no link variables.
  • Ok now it is really annoying as the behaviour changes not just when editing the sidebar but when entering edit on any page.

Make sure you close the %target=_blank% [[link]] with %% every time, or else all subsequent links in the same paragraph will open in new windows. Also, a skin or a recipe may modify the $UrlLinkFmt variable to force a target=_blank attribute. --Petko April 14, 2009, at 10:36 PM

How can I make a link back to site where I came from (like the button in the browser)?

How do I give a link a Tool Tip? eg [[Links"tool tip"]] or [[Links | here"tool tip"]]

See PITS:00657 and Cookbook:LinkTitles.

How do I use an InputSelection menue as a Link selection. Where do I include the Link-url in the code line?

Hi stan, what are you looking for exactly? Can you give an example. Is Forms or Menus not giving the answer yet? -- SchreyP June 05, 2010, at 05:23 AM

trying ... but want to use inside of a

[[http://somewhere_I_Want_opened_in_a_new_window | Somewhere]] [[%target=_blank% http://somewhere_I_Want_opened_in_a_new_window %%| Somewhere]] Above does not work I know I could just code my own a href's but would rather stick with wonderful wiki codes Ward Christensen

Hi Ward, try %target=_blank% or %newwin% outside the double square brackets, like %newwin% [[http://somewhere_I_Want_opened_in_a_new_window | Somewhere]]%%.
It could be that in Firefox it opens in a new tab, if "Open new windows in a new tab instead" is checked in Menu Tools > Options... under the tab "Tabs" -- SchreyP September 30, 2010, at 03:52 PM

Links with custom parameters?

With include-other-pages, it is possible to specify custom parameters, which can alter the content shown in the included page. Is it possible to do this with links? For example, to have a page which is a template, and the data drawn from page-text-variables elsewhere, based on the parameters specified? -- DougM27 January 13, 2011, at 10:38 AM

I don't know if your template can contain a URL parameter (you'd have to test), but you should at least be able to have your include directive contain one. (This requires Cookbook:HttpVariables.) For example: (:include MyFile MyParm={$?MyParm}:) RandyB February 26, 2011, at 10:55 AM

How do I enter links with round brackets

 (eg http://en.wikipedia.org/wiki/Deportee_(Plane_Wreck_at_Los_Gatos)

Use "%28" for "(" and "%29" for ")" Or use Cookbook:FixURL

How do I enter links with double quotes?

 Links with double quotes at the end can be mistaken for image tool tips

Replace double quotes (") with "%22"

All of the links on my pages have the external link icons (i.e. a little square with an arrow point to the upper right, see here for example: http://en.wikipedia.org/wiki/Help:External_link_icons) behind them? How do I get rid of them?

This happens because for some reason the links are considered external. This often happens when using the static page generator which converts some pages to html links. The simplest way to fix this is to edit local/config.php and place this text in there:

## This changes external links to not have the small link icon in them:
# This is the default:
#$UrlLinkFmt = "<a class='urllink' href='\$LinkUrl' title='\$LinkAlt' rel='nofollow'>\$LinkText</a>";
$UrlLinkFmt = "<a class='plainlinks' href='\$LinkUrl' title='\$LinkAlt' rel='nofollow'>\$LinkText</a>";

This only happens in some skins (monobook?). --Petko June 24, 2012, at 05:02 PM

linked image

[[http://www.pmwiki.org/pmwiki/uploads/Test/LinkImageExample.png"tool tip title" | Attach: link]]

Attach: link

inline image

http://www.pmwiki.org/pmwiki/uploads/Test/LinkImageExample.png"tool tip title"
tool tip title

Links with caption

Captions can be added to link standalone pictures by adding a vertical bar (|), see also Images.

[[http://pmichaud.com/img/misc/pc.jpg"Paper clips"]] | [- Image 1 -] 

[[http://#dummyaspmwikibroken | http://pmichaud.com/img/misc/pc.jpg"Paper clips"]] | [- Image 2 -]
http://pmichaud.com/img/misc/pc.jpg"tool tip title" | Image 3

http://www.pmwiki.org/pmwiki/uploads/Test/LinkImageExample.png"tool tip title 2"

http://www.pmwiki.org/pmwiki/uploads/Test/LinkImageExample.png | Image 3

http://www.pmwiki.org/pmwiki/uploads/Test/LinkImageExample.png

link only (not an inline image):
[[http://www.pmwiki.org/pmwiki/uploads/Test/LinkImageExample.png"tool tip title 4"]] | [- Image 4-]

http://pmichaud.com/img/misc/pc.jpg | Image 1

Paper clips
Image 2
tool tip title
Image 3
tool tip title 2

Image 3

link only (not an inline image): http://www.pmwiki.org/pmwiki/uploads/Test/LinkImageExample.png | Image 4


This is a talk page for improving PmWiki.Links.