1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Google's Schema Markup for webpages - Absolute vs Relative Urls

Discussion in 'Microdata' started by neetupahwa, Feb 8, 2014.

  1. #1
    Is there any difference if I insert absolute or relative links in the url while marking up schema. In the following code can i directly reference the image source as logo.png instead of http : // example.com/ logo. png.

    <div itemscope itemtype="http : // schema.org / Organization ">
    <a itemprop="url" href="http : // example. com ">Home</a>
    <img itemprop="logo" src=" http : // example. com/ logo.png" />

    neetupahwa, Feb 8, 2014 IP
  2. website1337

    website1337 Active Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Yes and no. No because it will look the same, but yes because relative paths searchs for the file in the current directory. For example, if you're on example.com/hello and have an relative path for logo.png, the browser will search for http://www.example.com/hello/logo.png. So what you may say, are the useful difference? Well, it depends on. Absolute paths are great because it doesn't matter which directory you're in, it will go to the specified source and grab the resource anyway. The negative thing with absolute paths is that you can't change domain name without modifying all paths. A workaround for this is to use Php (www.php.net for more information) to add the current used domain name. Another great way is to start the path with a "/" and then enter the requested file. This will start from the root directory (directory at the top, highest up). The useful part of relative paths is that as long as everything is in the same directory (or the same folder setup as described from the path) it will work.

    So just remember this - Absolute paths = Could be accessed from any place in your hierarchy
    And - Relative paths = Starts to access from current directory. (Note that you can go up a folder or enter a folder, for example "/images/logo.png" will start from current directory, search for a folder named images in current directory and inside that folder search for the image logo.png.

    Hope it helps!
    website1337, Feb 8, 2014 IP