.. include:: /shortcuts.rstext .. index:: single: Link Insert a link into text ---------------------------- :index:`When ` you are in the text editor, you can link to pages on the internet and to :ref:`pages within Mahara `. |new in Mahara 19.04| The visual editor allows you to decide whether links shall be opened in the same window or in a new tab or window. .. index:: single: Link; External web page .. _insert_external_link: Link to an external web page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |new in Mahara 19.04| :index:`External ` pages are opened in a new tab or window (depending on your browser configuration) automatically. .. figure:: /images/link_external.* :alt: Link to an external page Link to an external page #. In the editor window, select the text that you want to link. #. Click the *Link* icon |tinymce link|. The link configuration window opens. #. **Url**: Enter the URL for your link. Ensure that you use the correct protocol. In most cases, it is ``https://``. #. **Text to display**: You see the text that you highlighted. #. |new in Mahara 19.04| **Target**: You can select in which window the link is opened. * **None**: Use the defined default option. For external links that means that the page is opened in a new tab or window. * **Same page**: Open the link in the same window as the current page. * **New window**: Open the link in a new tab or window. #. Click the *OK* button to save your choice. #. Continue writing your text and then save your content. .. index:: single: Link; Internal portfolio page .. _insert_internal_link: Link to another portfolio page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can insert a link directly to one of your personal portfolio pages without needing to know its URL. .. note:: Currently, this feature only exists for linking to your own personal portfolio pages, but not for linking to other people's pages or group, institution, or site pages. .. figure:: /images/link_internal.* :alt: Insert an internal link into text Insert an internal link into text #. When you are in *Edit* mode of your page, select the *Text* block and drag it into the page editing area. .. note:: This works anywhere on the site where you have the visual editor available. #. Write the text that you want to link and highlight it. #. Click the *Link* icon |tinymce link|. The link configuration window opens. #. **Text to display**: You see the text that you highlighted. #. **Link list**: The drop-down menu shows all the collections and pages that are not in a collection to which you can link. #. Select the page to which your highlighted text should link. #. **Url**: The full path to the page is entered automatically into this field. #. |new in Mahara 19.04| **Target**: You can select in which window the link is opened. * **None**: Use the defined default option. For links within Mahara, the link opens in the same window as the current page. * **Same page**: Open the link in the same window as the current page. * **New window**: Open the link in a new tab or window. #. Click the *OK* button to save your choice. #. Continue writing your text and then save your content. .. index:: single: Link; Link anchor .. _insert_anchor: Insert a link anchor ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sometimes you may not wish to link to a particular page, but rather to a specific passage within a journal entry or some other text in a block. In this case, you can set an anchor and link to it. .. note:: Anchors only work within an artefact and not across pages or artefacts. That means that you can set an anchor within a journal entry, but you cannot link to that anchor from within another journal entry or text block. In order to use anchors, you need to: #. Set the anchor. #. Link to the anchor. .. _set_anchor: Set an anchor ^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: /images/link_anchor_insert.* :alt: Set an anchor in text Set an anchor in text #. When you are in *Edit* mode of your page, select the *Text* block and drag it into the page editing area. .. note:: This works anywhere on the site where you have the visual editor available. #. Write your long text and place the cursor in the line to which you want to link directly. #. Click the *Anchor* icon |tinymce anchor|. The anchor configuration window opens. .. note:: You need to click the *Toggle toolbars* icon |tinymce toggle toolbars| to see the *Anchor* icon. #. **Id**: Give your anchor a name so you can refer to it when setting your link. #. Click the *OK* button to save your decision. You return to the edit screen for your text and see a little anchor where you had positioned your cursor. #. Save your text. .. _link_to_anchor: Link to an anchor ^^^^^^^^^^^^^^^^^^^^^^ .. figure:: /images/link_anchor_use.* :alt: Link to an anchor Link to an anchor #. You need to have set an anchor to somewhere else in the text that you are currently editing. #. Highlight a word in your text that should take you to the anchor. #. Click the *Link* icon |tinymce link|. The link configuration window opens. #. **Text to display**: You see the text that you highlighted. #. **Anchors**: Select the anchor to which you want to link from the drop-down menu. #. **Url**: The anchor that you selected is displayed. .. note:: "user\_" is added automatically as the visual editor TinyMCE requires it for the anchor to work. #. Click the *OK* button to save your choice. #. Click the *Save* button to save your text. #. When you display the page (outside of the *Edit* mode), you can click the linked text. You will jump to the section to which you had linked within that same text.