What is the cite attribute for?

前端 未结 7 1933
醉话见心
醉话见心 2021-02-05 10:01

The cite attribute specifies the address of the source of the quoted text, I think, but who uses this information?

For example:



        
7条回答
  •  情深已故
    2021-02-05 10:50

    Both the tag and the cite attribute are for semantic purposes, which means that they are simply for giving a website more "meaning". For example, I could use a

    tag for a quote, rather than using a
    tag, but this provides less meaning to the browser, and hence using
    is recommended for quotes.

    The same is with the tag and cite attributes. As per the MDN definition for the cite attribute (link here):

    Use the cite attribute on a or element to reference an online resource for a source.

    "so who does use this information, and how?" - I believe that search engines (e.g. Google) would use this information to show potential links between documents. If you think about this it is a major point. Check out the image below:

    Search of Samsung on Google

    Notice how it shows the "Samsung Group" information box on the right. The guys who work at Google don't write this information - rather, it is sourced from Wikipedia. However, this information would be of greater relevance to the search "samsung" when this information is also written on other websites, with the cite attribute linking this information to Wikipedia (hence increasing the relevancy of Wikipedia). This is why Wikipedia's information is used here, and not some primary school's website regarding Samsung phones.

    The cite attribute simply provides more meaning to the website. Tim Berners-Lee has described the semantic web as a component of "Web 3.0" - in other words, many components of the updating HTML language are simply to provide more meaning onto the webpage, as a step closer to Web 3.0.

    TL;DR - in simpler terms, the cite attribute is just to provide more meaning to the web page, and may be used for search engines for better web linkage.

提交回复
热议问题