Trying to add anchor and/or Id tag in New Google Sites
Asked Answered
E

2

8

I'm trying to create a website using the New Google Sites - where a lot of basic 1990's html functionality has been removed. It would be REALLY useful to add anchors, but the gSites FAQ states that anchors as not supported in the New Google Sites. There are no 'easy' anchor buttons etc... So I thought I could end-run them and code in an ID tag inside since you can insert custom html.

At the relevant section on the page I wrote, using their HTML insert tool:

<p id="assignment2"><hr></p>

Then call it up at the top of the webpage using their HTML insert tool:

<p><a href="#assignment2">Assignment #2</a><p>

That returned an error after publishing it and trying to follow the link. So I instead tried just writing Assignment #2 and adding a hyperlink to is pointing to:

https://sites.google.com/view/<websiteurl>#assignment2

This results in going to the top of the page, but never jumping down to the relevant anchor.

Are there other clever methods somebody can think of to jump to a specific spot on a page if the ID tag appears to be non-functional?

TIA

Earl answered 17/2, 2018 at 23:15 Comment(1)
James is correct. You'll need to have your page in both edit mode and published mode in separate tabs (at least that's how I did it). Hover over the headings in the published site and click on the link icon next to the header name. That will put the entire HTML code on the clipboard. Switch to your edit mode page, highlight the text you want to link to the anchor, create a link, and paste in the code from the clipboard. Yes. It. Is. Tedious. But. It. Worked...Rabassa
E
2

Sometime in the past month or two Google Sites has now enabled anchor linking. They don't call it that, there's a button at the edge of individual div's that asks if you want to "copy anchor link", but this generates a url that links to that specific block from either an internal or an external page (but only if you've used something other than 'normal' text size - so subheading, title etc... will show this link icon). Can't understand why this wasn't enabled from launch, but ah well, at least it's there now.

https://i.sstatic.net/CgJaH.png

Earl answered 3/11, 2018 at 19:11 Comment(1)
The problem with this is, that it really opens the link in a new tab. Usually I would hope it would use just a local reference if it is on same page.Hedveh
C
4

So many people asking this question... I can't believe it doesn't work, the whole point of the HT in HTML is that you can link anywhere within or between public documents. Anyway I think I've found a lame workaround. Though the issue is it gives you a redirect notice.

All the header tags are given an ID. You can copy this id, then add a link in with the full URL of your Google Sites page, followed by the # and the id.

Eg:

https://sites.google.com/view/{your-google-sites-alias}/home#{id-from-heading-tag}
Complot answered 24/7, 2018 at 11:47 Comment(4)
How can I find the "id"?Intrigante
Google devs are getting experts in removing functionality and make google tools dumber and dumber.Intrigante
In Chrome, you will need to right click on the heading you want to link to and click "Inspect", then you will see the id in the heading tag. Copy everything between the quotes of id="hducuc77", eg hducuc77 here is {id-from-heading-tag} in the above link.Complot
same issue. it opens in a new tab. How to make it an anchor these days?Meijer
E
2

Sometime in the past month or two Google Sites has now enabled anchor linking. They don't call it that, there's a button at the edge of individual div's that asks if you want to "copy anchor link", but this generates a url that links to that specific block from either an internal or an external page (but only if you've used something other than 'normal' text size - so subheading, title etc... will show this link icon). Can't understand why this wasn't enabled from launch, but ah well, at least it's there now.

https://i.sstatic.net/CgJaH.png

Earl answered 3/11, 2018 at 19:11 Comment(1)
The problem with this is, that it really opens the link in a new tab. Usually I would hope it would use just a local reference if it is on same page.Hedveh

© 2022 - 2024 — McMap. All rights reserved.