HTML linking

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: HTML linking.

Creative Moodlers have come up with some ways to use HTML linking to navigate within a Moodle site. This page will give some examples. It is always a good idea to test any links with the permissions of a student to make sure they work.

Formats of common internal links

Essentially the Moodle id is a unique number associated with a datatable record. Moodle calls up the right module in view mode and then points that towards an object(database record) that is identified with an id. It is important to pay close attention to the address bar when logged in as a non-student/guest and as a student/guest.

The examples below were created in and used the Features Demo lesson in the examples.

Tip: One way to copy a location using most browsers is to right click on the object, then select the "copy location link". Then paste this address into the HTML link popup tool.
Tip: It is important to be aware of roles and permissions. For example, a student who does not have permission to enter a course can not jump to a page in that course.

Course ""Moodle Features Demo" course. "Higher Education Film Studies Module" course.


  • "Moodle Features Demo course, Lesson: Lesson 1"
  • "Moodle Features Demo course, Assignment: Upload a single file"
  • "Moodle Features Demo course, Forum: A standard forum for general use" "Moodle Features Demo course, Wiki: Course summary wiki"

Lesson page

The easiest way to determine a Lesson page's location is to use the edit tab and the collapsed view. Find the page and use the preview icon to view the page. The browser address bar will show the page location. Note id=224 is Lesson 1, id=225 is Lesson 2.

  • "Moodle Features Demo course, Lesson 1" page 1 (Title: A Demonstration Lesson) The first page of the lesson.
  • "Moodle Features Demo Course, Lesson 1" page 1 (Title: A Demonstration Lesson) also the first page of the lesson.
  • "Moodle Features Demo course, Lesson 1" page 8 (Title: Building lessons) a multiple choice question.
  • Moodle Features Demo course, Lesson 1 page 14 (Title: Score the simple way) a branch page.
  • Moodle Features Demo course, Lesson 2 page 3 (Title: Multianswer) a multianswer question page.

Wiki page links "Moodle Features Demo course, Wiki: Course summary wiki" opening page.

These pages do not exist in demo.moodle and these address will take the student to the page in edit mode. If the page exists, the student will view the page via the link.

  • "Moodle Features Demo course, Wiki: Course summary wiki" A page called "New page".
  •"Moodle Features Demo course, Wiki: Course summary wiki" A page called "WikiPageLink".

Forum threads

Forums have a slightly more confusing formats. A forum has an activity id and also has a forum id.wa An easy way to identify the forum id is to click on a forum, then click on the forums link in the breadcrumb. By entering a forum this way (or holding your mouse over the link) you will immediately see the f= id.

  • The forum activity id. Student see forum with threads.
  • The forum id. Student sees forum with threads
  • will create a blank post in edit mode for the student in the forum.

The third forum is a single post discussion. Here you will see the #p being used in the address bar. Essentially this number is only useful in the edit mode and is ignored in the view mode.

  • A single post discussion forum
  • The teacher's first page.

These pages were created on demo.moodle in the single post forum. The students first post in the forum. In view mode this is the same as f=18 .

  • The link to send the student back to their post in edit mode. (Remember that if time expires, they will not be able to edit).

Here is a link to a forum discussion on Higher Education Film Studies Module: Topic 3: Women, Robots and Dirty Dishes (1970s) and the forum called "Women and Robots". This is an open enrollment course, so a link from another course, will first ask the student if they wish to enroll. The Women and Robots forum showing all threads.

  • This is the thread on "Emotion and The Stepford Wives" in the Women and Robots forum.

Resource links

Find the file using the course administration block and the files link. An mp3 file located in Features Demo Course files>media.

  • An image file located in Features Demo Course files>images .
  • An image file located in the Higher Education Film Studies Module course.
  • An word document file located in the Higher Education Film Studies Module course.

How to create a link

For the purpose of example, we will use the content area of a branch table. What is important is that it where ever the link is being added, that it has the standard Moodle HTML edit bar.

  • Find the page you want to link to and copy or note the address in the address bar
  • Go to the content area where you want to place the link
  • Type the text you would like the reader to see.
  • Block (highlight) the text
  • Select the insert web link tool (chain link icon)
  • Paste the address in the first line of the popup box
  • Optional-enter the arrow text
  • Save the popup tool.
  • Words should now indicate they are linked (usually underlined or in blue).

Repeat as needed.

How to link with a HTML edit bar

Page_content for more information

Ed link.gif

HTML Link Insert moodleorg.JPG

<a href="">HERE</a>

How to link without a HTML edit bar

The easy way is to put in the link somewhere that has an HTML edit bar, then go to text mode, copy the code and then paste it. This will usually work for pictures and most links.

Shorten generic link formats

This is section requires more knowledge. In most of the examples on this page, the full HTML link is used. This works if you are not moving your course or site to another URL. However, it is possible to shorten the link so it will translate better in a backup and restore to another site.

This trick will only work if your moodle is located directly off the webroot, such as it is in
  • <a href=""> A link to a resource that happens to be found in Features Demo</a>
    • The above link is an example of the full or long html link.
TIP: Remember that a resource id's is different than a course or an activity id. And there are lots of "view.php" files in Moodle :)
  • <a href="view.php?id=232" title="rl">A link to resource that happens to be in Features Demo</a>
    • This entry was placed in a main menu block on the front page of in a Web page resource.
    • The short address worked because it assumed the call was made from "moodle/mod/resource".
  • <a href="/course/view.php?id=5"> A link to features Demo</a>
    • An example of a short link placed in an Web page resource in a main menu block in
    • Note it is required to put more of the path because the call will start in the mod/resource directory but we want to view a course not a resource.
  • <a href="/mod/lesson/view.php?id=224"> A link to a lesson</a>
    • An example of a short link placed in a Web page resource in a main menu block in .

Finally, if your moodle is not at the site root, say it is at, then these short cuts will not work. You may have to add Moodle196 to the path. And of course if you backup and try to restore to another site that does not have the same file structure, the links will be broken. Sorry.

Internal Linking ideas

  • There was the Library (aka Course) of Lessons and resources idea. Essentially set up a course as an open library, use topics to loosely organize activities and resources. Use links from within other courses for standard refreshers or what ever. Paste them in a wiki, in a lesson (content area, answer, teacher response), you get the idea.
  • Category "course short cut" or a course redirect. Put a course in one category, that redirects the student to the real course in another category. Simple, put an HTML link in the course title to the other course's home page.
  • The use of links to create an index of lesson pages in the content area, instead of branch table jumps. This gives endless possibilities of groupings and directions to send students.
  • Or master site matrix created on one or more resource pages using links that direct to courses, activities, resources on the Moodle site.
  • Create a series resources pages, copy the browser link addresses to paste into the next and back hyperlink. Perhaps use a "link to file" or web address resource to open a second window in the course to start the series of linked pages.
  • Use internal linking and hidden topics to visually shorten a course page for a student. See the Course homepage Tips and tricks section.
  • Allow students to see their grades once they reach a certain page in an activity (for example a Lesson page). Use the Switch Role to switch to Student. Move your mouse over the link to "Grades" and copy the link location. The link to a user report will look like this

See also