Both sides previous revision Previous revision | Next revisionBoth sides next revision |
wordpress [2017/05/18 16:43] – Sectioning for easier edition. Replaced HTML table with DokuWiki table Toni Corvera | wordpress [2017/05/18 17:53] – [Relative URLs] Converted HTML Toni Corvera |
---|
Additionally I added a couple extra modifications to generate valid XHTML, and made the link also display the article's title. | Additionally I added a couple extra modifications to generate valid XHTML, and made the link also display the article's title. |
| |
Let's compare Interlinks and Interlinks+:^ ^ Interlinks |^ Interlinks+ || | | | Let's compare Interlinks and Interlinks+: |
^ Code ^ Generated HTML ^ Rendered HTML ^ Generated HTML ^ Rendered HTML | | | | |
| <code>[[My article]]</code> | <code><a href="http://example.invalid/my-article/">My article</a></code> | http://example.invalid/my-article/ | <a href="http://example.invalid/my-article/" title="My article">My article</a> | http://example.invalid/my-article/ | | | | |
| <nowiki>[[My article|My first article]]</nowiki> | * <code html><font color='red'>My article</font></code> | My first article</font> | My article | My first article | <a href="http://example.invalid/my-article/" title="My article">My first article</a> | http://example.invalid/my-article/ | | |
| * [[Broken]] | * <font color='red'>Broken</font> | Broken | | * Broken | | | | |
| |
| ^ \\ Case 1: Standard interlink ||^ |
| | Example: ''<nowiki>[[My article]]</nowiki>'' ||| |
| ^ ^ Interlinks ^ Interlinks+ ^ |
| ^ Generated HTML | <code html><a href="http://example.invalid/my-article/">My article</a></code> | <code html><a href="http://example.invalid/my-article/" title="My article">My article</a></code> | |
| ^ Rendered HTML | <html><a href="http://example.invalid/my-article/">My article</a></html> | <html><a href="http://example.invalid/my-article/" title="My article">My article</a></html> | |
| ^ \\ Case 2: Interlink with user-supplied text ||^ |
| | Example: ''<nowiki>[[My article|My first article]]</nowiki>'' ||| |
| ^ ^ Interlinks ^ Interlinks+ ^ |
| ^ Generated HTML | <code html><font color='red'>My article</font></code> | <code html><a href="http://example.invalid/my-article/" title="My article">My first article</a></code> | |
| ^ Rendered HTML | <html><span style="color:red;"><nowiki>My article|My first article</nowiki></span></html> <label type="warning">broken link</label> | <html><a href="http://example.invalid/my-article/" title="My article">My first article</a></html> | |
| ^ \\ Case 3: Broken link ||^ |
| | Example: ''<nowiki>[[Broken]]</nowiki>'' (where "Broken" doesn't exist) ||| |
| ^ ^ Interlinks ^ Interlinks+ ^ |
| ^ Generated HTML | <code html><font color='red'>Broken</font></code> | <code html><span style="color:red;">Broken</span></code> | |
| ^ Rendered HTML | <html><span style="color:red;">Broken</span></html> <label type="warning">broken link</label> | <html><span style="color:red;">Broken</span></html> <label type="warning">broken link</label> | |
| |
| |
<div class="tiny"><dfn class="tt">*</dfn> indicates a broken interlink</div> | |
<table style="width:100%;padding:0;margin:0;border:1px solid black;font-size:small;"> | |
| |
<!-- End of Interlinks+ --> | |
| |
===== Relative URLs ===== | ===== Relative URLs ===== |
<p><a href="files/net_outlyer_wp-relativeurls.php">Download v1.5</a> (last update october 14th 2007)</p> | <p><a href="files/net_outlyer_wp-relativeurls.php">Download v1.5</a> (last update october 14th 2007)</p> |
| |
<p><em>Relative <abbr title="Uniform Resource Locator">URL</abbr>s</em> | Relative URL<nowiki>s</nowiki> is mainly targeted at people with a **local copy** of their WordPress site and those that **reorganise and/or change their pages hierarchy often** although many standard installations can also take advantage of it. |
(hereon <abbr title="Relative URLs">RU</abbr>) is | |
mainly targeted at people with a <strong>local copy</strong> of their | |
WordPress site and those that <strong>reorganise and/or change their | |
pages hierarchy often</strong> although many standard installations | |
can also take advantage of it.</p> | |
| |
<p><abbr title="Relative URLs">RU</abbr> can be seen as kind of complementary | //Relative URLs// can be seen as kind of complementary to Interlinks: It creates a valid URL or link from a relative path. |
to Interlinks: It creates a valid URL or link from a relative path. | \\ |
<br /> | If you want to link to a post Interlinks or Interlinks+ are better alternatives, but if you want to link to a given file in your site neither will help you. |
If you want to link to a post Interlinks or Interlinks+ are better alternatives, | \\ |
but if you want to link to a given file in your site none of them will help you. | I guess so far it isn't clear what's the need for such a plugin, so let's clarify a bit, note that: |
<br /> | |
I guess so far it isn't clear what's the need for such a plugin, so let's clarify | |
a bit, note that:</p> | |
| |
<ul><li>Pages can be accessed from more than one URL (I'm assuming | * Pages can be accessed from more than one URL (I'm assuming your WordPress installation is in a subdirectory and URL redirection is being used): |
your WordPress installation is in a subdirectory and URL redirection | * <html><samp>http://example.com/parentpage/page/</samp></html> |
is being used): | * <html><samp>http://example.com/wordpress/parentpage/page/</samp></html> |
<ul> | * <html><samp>http://example.com/wordpress/?page_id=2</samp></html> |
<li><samp>http://example.com/parentpage/page/</samp></li> | * Using an absolute URL to refer to stuff in the site has the potential of being broken if you |
<li><samp>http://example.com/wordpress/parentpage/page/</samp></li> | * Change WordPress' path, e.g.: <html><samp>http://example.com/wordpress/</samp></html> is moved to <html><samp>http://example.com/</samp></html> or <html><samp>http://example.com/blog/</samp></html>. |
<li><samp>http://example.com/wordpress/?page_id=2</samp></li> | * Change your (sub)domain, e.g. <html><samp>http://example.com/</samp></html> becomes <html><samp>http://blog.example.com/</samp></html>. |
</ul> | * Using a relative URL to refer to stuff in the site has the potential of being broken if you (or visitors) |
</li> | * Access from a different URL, e.g.: A relative URL like <html><samp>images/im.jpg</samp></html> will point to different things when accessed from <html><samp>http://example.com/parentpage/page</samp></html> (<html><samp><var>http://example.com/parentpage/page/images/im.jpg</var></samp></html>) and <html><samp>http://example.com/wordpress/?page_id=2</samp></html> (<html><samp><var>http://example.com/wordpress/images/im.jpg</var></samp></html>). |
| |
<li>Using an absolute URL to refer to stuff in the site has the potential | Finally, if you use a local copy of WordPress to test stuff, chances are your local copy would have quite a different URL, e.g. <html><samp>http://localhost/~username/wordpress/</samp></html> and you might want your URLs to point to the local copy and not the on-line site.</p> |
of being broken if you | |
<ul> | |
<li>Change WordPress' path, e.g.: <samp>http://example.com/wordpress/</samp> | |
is moved to <samp>http://example.com/</samp> or <samp>http://example.com/blog/</samp>. | |
</li> | |
<li>Change your (sub)domain, e.g. <samp>http://example.com/</samp> | |
becomes <samp>http://blog.example.com/</samp>.</li> | |
</ul> | |
</li> | |
| |
<li>Using a relative URL to refer to stuff in the site has the potential | ==== Usage ==== |
of being broken if you (or visitors) | |
<ul> | |
<li>Access from a different URL, e.g.: A relative URL like <samp>images/im.jpg</samp> | |
will point to different things when accessed from | |
<samp>http://example.com/parentpage/page</samp> | |
(<samp><var>http://example.com/parentpage/page/images/im.jpg</var></samp>) | |
and <samp>http://example.com/wordpress/?page_id=2</samp> | |
(<samp><var>http://example.com/wordpress/images/im.jpg</var></samp>). | |
</li> | |
</ul> | |
</li> | |
</ul> | |
| |
<p>Finally, if you use a local copy of WordPress to test stuff, chances | Enclose your local URL in double braces (e.g. <html><samp></html>''<nowiki>{{myrelative/url}}</nowiki>''<html></samp></html>), to get a full URL generated dynamically, e.g. to <html><samp>http://example.com/wordpress/myrelative/url</samp></html>. |
are your local copy would have quite a different URL, e.g. | |
<samp>http://localhost/~username/wordpress/</samp> and you might | |
want your URLs to point to the local copy and not the on-line site.</p> | |
| |
<h3 id="ru-usage">Usage</h3><!-- of Relative URLs --> | Enclose your local URL in double braces along a text description (separated by a space) to get a dynamically generated link to the full URL. |
| \\ |
| <html><samp></html>''<nowiki>{{the_url/file.txt The text file}}</nowiki>''<html></samp></html> would become |
| <html><samp><a href="http://example.com/wordpress/the_url/file.txt">The text file</a></samp></html>. |
| |
<p>Enclose your local URL in double braces (e.g. <samp>{{myrelative/url}}</samp>), to get a | Note you'll have to encode any spaces in the url (e.g. to link to "<html><samp>the file</samp></html>"; you'll have to encode the space (replace it with ''%20'') |
full URL generated dinamically, e.g. to <samp>http://example.com/wordpress/myrelative/url</samp>.</p> | i.e.: <html><samp></html>''<nowiki>{{the%20file}}</nowiki>''<html></samp></html>. |
| |
<p>Enclose your local URL in double braces along a text description (separated by a space) | ==== Escaping Relative URLs ==== |
to get a dinamically generated link to the full URL. | |
<br /> | |
<samp>{{the_url/file.txt The text file}}</samp> would become | |
<samp><a href="http://example.com/wordpress/the_url/file.txt">The text | |
file</a></samp>. | |
<br /><br /> | |
Note you'll have to encode any spaces in the url (e.g. to link to | |
"<samp>the file</samp>" you'll have to encode the space (replace it with | |
<kbd>%20</kbd>) i.e.: <samp>{{the%20file}}</samp>.</p> | |
| |
<h4 id="ru-escape">Escaping <em>Relative URLs</em></h4> | If you want to write literal double curly brackets (''{{'') then you'll have to use an //html entity// such as <html><samp></html>''{''<html></samp></html> and |
| <html><samp></html>''}''<html></samp></html> (or <html><samp></html>''{''<html></samp></html> and <html><samp></html>''}''<html></samp></html>). |
<p>If you want to write literal double curly brackets (<kbd>{{</kbd>) then | For maximum security use at least one on each end, e.g. |
you'll have to use an html entities such as <samp>&#x7b;</samp> and | <html><samp></html>''{{\_whatever\_}}''<html></samp></html> will be parsed correctly as |
<samp>&#x7d;</samp> (or <samp>&#123;</samp> and <samp>&#125;</samp>). For | <html><samp></html>''{{\_whatever\_}}''<html></samp></html>. |
maximum security use at least on each end, e.g. | \\ |
<samp>&#x7b;{ whatever &#x7d;}</samp> will be parsed correctly as | |
<samp>{{ whatever }}</samp>. | |
<br /> | |
BUT beware of the visual editor in WordPress (although if you use it you're | BUT beware of the visual editor in WordPress (although if you use it you're |
probably used to fight it ;).</p> | probably used to fight it ;). |
| |
<!-- End of Relative URLs --> | |
| |
===== JS Base2 ===== | ===== JS Base2 ===== |