{"id":159915,"date":"2025-10-01T14:24:27","date_gmt":"2025-10-01T18:24:27","guid":{"rendered":"https:\/\/www.bu.edu\/tech\/?page_id=159915"},"modified":"2025-10-01T14:28:08","modified_gmt":"2025-10-01T18:28:08","slug":"anchor-links","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/services\/cccs\/websites\/www\/wordpress\/how-to\/anchor-links\/","title":{"rendered":"Create anchor links"},"content":{"rendered":"<p>Web pages with a lot of content may benefit from well-structured headings accompanied by links at the top of the page to the content headings. The concept is analogous to a table of contents. These are commonly referred to as anchor links.<\/p>\n<p>You create a regular link (standard anchor tag in HTML) but in this case you link to a section on the same page using the <code>id<\/code> attribute of that section&#8217;s heading. This requires a bit of HTML editing (switching out of Visual editor into Text editor) but is relatively easy. Example code is included below.<\/p>\n<p>First, organize your content using <code>h2<\/code> headings at the beginning of your content sections. Use concise headings with relevant keywords.<\/p>\n<p>Next, in Text\/HTML editing mode, add <code>id<\/code> attributes with unique keywords to your headings. Remember to use unique <code>id<\/code>s that are not repeated elsewhere on the page. In the example code below, <code>id=\"intro\"<\/code>, <code>id=\"research\"<\/code>, <code>id=\"findings\"<\/code>, and <code>id=\"conclusions\"<\/code> are the attributes added to heading tags.<\/p>\n<p>When your headings are in place and have unique <code>id<\/code>s, you can then link to them from elsewhere on the page. Type your link text and highlight it, click the link button, but instead of searching for page\/post or typing in a URL, enter the hashtag symbol <code>#<\/code> followed by the id of the section you want to link to. Important: begin every anchor link with the hashtag symbol &#8212; that is how web browsers know it&#8217;s an anchor link.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&lt;!-- Anchor Links --&gt;\r\n&lt;ul&gt;\r\n&lt;li&gt;&lt;a href=&quot;#intro&quot;&gt;Introduction&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;li&gt;&lt;a href=&quot;#research&quot;&gt;Research&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;li&gt;&lt;a href=&quot;#findings&quot;&gt;Findings&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;li&gt;&lt;a href=&quot;#conclusions&quot;&gt;Conclusions&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;\/ul&gt;\r\n\r\n&lt;!-- Anchor destinations --&gt;\r\n\r\n&lt;h2 id=&quot;intro&quot;&gt;Introduction&lt;\/h2&gt;\r\nThis is the content for the Introduction section of the page.\r\n\r\n&lt;h2 id=&quot;research&quot;&gt;Research&lt;\/h2&gt;\r\nThis is the content for the Research section of the page.\r\n\r\n&lt;h2 id=&quot;findings&quot;&gt;Findings&lt;\/h2&gt;\r\nThis is the content for the Findings section of the page.\r\n\r\n&lt;h2 id=&quot;conclusions&quot;&gt;Conclusions&lt;\/h2&gt;\r\nThis is the content for the Conclusions section of the page.\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Web pages with a lot of content may benefit from well-structured headings accompanied by links at the top of the page to the content headings. The concept is analogous to a table of contents. These are commonly referred to as anchor links. You create a regular link (standard anchor tag in HTML) but in this&#8230;<\/p>\n","protected":false},"author":8,"featured_media":0,"parent":304,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/159915"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=159915"}],"version-history":[{"count":9,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/159915\/revisions"}],"predecessor-version":[{"id":159926,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/159915\/revisions\/159926"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/304"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=159915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}