Support » Plugin: Yada Wiki » Wiki Link to Anchor Link?

  • Resolved nephanor

    (@nephanor)


    Is it possible to send a Wiki Link to an anchor within a Wiki page? The idea I am looking for is where you can have a link that takes you to a specific point on the page, not just the page itself, denoted by an anchor.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author dmccan

    (@dmccan)

    Interesting idea. It is not possible now using the shortcodes. I guess you could manually add links that include an on-page anchor link, but that would be cumbersome.

    Thread Starter nephanor

    (@nephanor)

    What about adding a new tag to the short code? link=”main page” anchor=”anchor”, then it just adds the #anchor to the end of the URL. Also be cool to add a class=”custom_class” addition. That way people can customize the class of the links, should they want. Another idea I had that I was gonna suggest in another thread.

    Plugin Author dmccan

    (@dmccan)

    Here is some information on styling the links:

    https://www.webtng.com/wiki/css-classes/

    It seems like if the #anchor was added to the end of the URL then you would still need to create the on-page anchor that it was targeting.

    Thread Starter nephanor

    (@nephanor)

    Yup, And that’s easy enough to do in regular page making (I generally make pages in HTML, just use the shortcodes for links and pictures), it’s the adding the anchor to the Wiki link that is the issue, and which is why adding it to the plugin would be necessary. Something like this:

    [yadawiki link=”Cities in France” anchor=”Paris” show=”Paris”]

    Would yield the HTML:

    <a href="http://YourSite.com/wiki/CitiesInFrance/#Paris" class="wikilink-published">Paris</a>

    • This reply was modified 4 months, 3 weeks ago by nephanor.
    • This reply was modified 4 months, 3 weeks ago by nephanor.
    Plugin Author dmccan

    (@dmccan)

    I’ll take a look to see what’s involved and report back.

    Plugin Author dmccan

    (@dmccan)

    Hi @nephanor – I’ve done some testing and I can do this:

    -Add an optional param to the Wiki Link shortcode called “anchor”. It would need to be added manually and the target would need to be set on the target page manually.

    -If “anchor” has a value, test if it has a “#” in front, if not then add a “#”.

    -Append the anchor variable to the end of the permalink.

    The syntax would look like this:

    [yadawiki link="Coffee and Tea" show="Hot Beverages" anchor="#jumptarget"]

    The output on the page would look like this:

    <a href="http://wikitest.local/wiki/coffee-and-tea/#jumptarget" class="wikilink-published">Hot Beverages</a>

    Here is the target syntax:

    <h2 id="jumptarget">This is the Jump Target</h2>

    That looks like what you are suggesting. Have I missed anything?

    Best,

    David

    Thread Starter nephanor

    (@nephanor)

    Yup, that looks exactly like what I was thinking even down to the algorithm! If I knew my way around the inside of WP plugins, I’d probably code it in myself, but I am still learning the ins and outs. Thanks!

    Plugin Author dmccan

    (@dmccan)

    Hi @nephanor,

    This was published. Could you please try it out?

    Thanks,

    David

    Thread Starter nephanor

    (@nephanor)

    That works GREAT! Thanks! Tested with both the # and without and still picked it up no problem!

    Plugin Author dmccan

    (@dmccan)

    Thanks for confirming it works as expected.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.