How Do I Unattach Image from Page?

  • When I first started with WordPress, I tested uploading an image and “attached” it to the About page. After reading the discussion above, I realized that was a mistake. I deleted the image and all images I am using in Posts and Pages now are unattached. The problem I see is that my sitemap.xml still refers to the deleted image as being part of the About page.

    1) This looks like a bug. The WordPress code isn’t updating sitemap.xml to reflect items deleted from the Media Library.

    2) This brings up a related point, which is how do I make sure images I care about get into an image sitemap (I guess that means that an image tag is included in sitemap.xml). It looks like the only way to do this today would be to attach the image from the library to a Post or Page, and then fill out all of the Title, Alt, Description tags on the separate Media Library page (the attachment_id=? page). It looks like the attributes on the attachment_id page get copied into the sitemap.xml file and then associated with the different Page or Post that you have “Attached” the image to.

    At minimum, the above looks like a strange design. Image tags in sitemap are being implemented as complex side-effects of completely different features, which then interact with each other.

    Relying on any of this behavior feels like something that would be likely to break when they fix the design. Is there a more portable way to get the image tag created in sitemap.xml?

  • @ poetrydude66

    1) This looks like a bug. The WordPress code isn’t updating sitemap.xml to reflect items deleted from the Media Library.

    I just checked your sitemap here: http://poetrydude66.wordpress.com/sitemap.xml

    I don’t see any images attached to the About page in your sitemap, so it looks like your sitemap was correctly updated. Please note that it can take some time for the sitemap to update after you make a change, and you may need to clear your browser’s cache if the old version of your sitemap is being saved in your browser.

    2) This brings up a related point, which is how do I make sure images I care about get into an image sitemap (I guess that means that an image tag is included in sitemap.xml).

    Images that are attached to a post or page are included in the sitemap. You can automatically attach an image by using the Add Media button in the post editor and uploading the image when you create or edit the post/page. When you upload and insert the image there, you can add a Title, Caption, Alt Text, and Description if you’d like.

    Please let me know if you have any questions about that. :)

  • Rachel, now the image is gone. I have no idea why. I did nothing on my end.

    Is it possible that it takes a week after you delete an image for the attachment_id page and the references to that in sitemap.xml to get changed? Maybe this is all maintained by separate processes in the background, that work on a delayed schedule?

    In general, can you advise whether having an image tag in sitemap has any added value for SEO over just having a link to the image in the page itself with the proper ALT, TEXT, DESCRIPTION tags filled in?

    I may not want to do any extra work on an ongoing basis if it doesn’t actually buy me anything with Google’s search engine.

  • Hi there,

    It can take some time for the sitemap to be updated, but it’s also possible that the old sitemap is being cached by your browser. It’s hard to say what happened in this case, since the sitemap looked right to me when I checked. If you run into this again, you can reply here to let me know and I’ll take another look at your sitemap.

    In general, can you advise whether having an image tag in sitemap has any added value for SEO over just having a link to the image in the page itself with the proper ALT, TEXT, DESCRIPTION tags filled in?

    Sitemaps are used to help search engines crawl websites for updates, so in general, including more information in your sitemap could give search engines more to work with. However, there’s no guarantee that this will add value — search engines use a wide variety of information to determine a site’s ranking.

  • Rachel, is there any WordPress add-on or feature here that would let WordPress.com automatically generate the IMAGE tag in the sitemap.xml file only using the IMG tags that I have embedded in the actual Post html file?

    It would require less of my time, and be far more maintainable, to create the Alt and other attributs inline inside my HTML page, and then WordPress uses that information to create the IMAGE tags in sitemap.xml for me.

    The way things appear to be now, I have to create create pages I will never use by “attaching” images to other HTML pages, and then duplicate all of the Alt and Title information on those additional pages. Then, as a side effect of that additional page, you are creating the IMAGE tag in sitemap.xml.

    Among other problems, with that approach if I ever change the Alt tag in the actual HTML page, it won’t reflect in the sitemap, since sitemap is grabbing the information from some other page associated with the content page.

  • Hi there, I’m not sure I entirely understand what you’re looking for here:

    is there any WordPress add-on or feature here that would let WordPress.com automatically generate the IMAGE tag in the sitemap.xml file only using the IMG tags that I have embedded in the actual Post html file?

    This is how sitemaps work — when you create a post or page and insert an image, that image will be added to the sitemap. When you insert the image into the post or page, you can add the title, alt tag, and description as you go. We have more information about how that works here: Images – Upload Images from Your Computer

    The additional steps you described (creating extra pages and attaching images) aren’t necessary if you’re already uploading and inserting the images in another post or page. Please let me know if you have questions about that.

  • Rachel, I hand crafted my HTML. I never pressed any button in the visual editor to insert an image. I uploaded the images manually to the Media library, and I referred to them explicitly in the hand crafted HTML.

    How is the HTML inserted when you use the insert button in the visual editor different?

    The hand crafted HTML at the top of my one Post (still holding back on more content until I understand WordPress a little better) is as follows. This code did NOT result in any IMAGE tag being inserted into my sitemap. The feature I was requesting was that WordPress scan the HTML looking for Images, and then give any images it finds an IMAGE tag in sitemap.

    Note that the image inserted by the following code is visible in the Visual editor and I can select its properties and get the same dialog that an image inserted through the Visual editor would give. Yet in spite of that my hand-crafted code does not create an IMAGE tag in sitemap. Maybe that’s a bug?

    <p style="text-align:center;"><a href="http://poetrydude66.files.wordpress.com/2013/11/ed-sheeran-and-taylor-swift-impressionist-painting_vangogh-starry-night_6mpix_01.jpg"><img class="aligncenter size-full wp-image" id="i-7" title="Impressionist Painting Ed Sheeran Taylor Swift Performing Everything Has Changed" alt="Impressionist Painting Taylor Swift Ed Sheeran Performing Everything Has Changed" src="http://poetrydude66.files.wordpress.com/2013/11/ed-sheeran-and-taylor-swift-impressionist-painting_vangogh-starry-night_6mpix_01.jpg" /></a></p>

  • Thanks for the additional details — now I have a better idea of what’s happening. Uploading and inserting an image into your post with the Add Media button will automatically attach it to your post, and that will add it to the sitemap. For that reason, I recommend writing your posts in the editor rather than writing the HTML separately and uploading the images manually to the media library.

    If you prefer not to use the post editor in your dashboard, you might be interested in crafting your posts in an offline editor, instead. We have some suggestions for editors than can post directly to your blog here: Offline Editing

    I hope this clarifies the relationship between creating posts, inserting images, and how sitemaps are created.

  • Okay, so we were saying the same thing but from different angles. You were saying to use the Add Media button, which not only uploads to Media library, but transparently creates the attachment_id= page and attaches it to the Post. I was doing the same thing in a different sequence. I was hand-crafting the HTML, then pointing out that in order to get an IMAGE tag in sitemap I needed to manually attach the media item page to the Post. You end up in the same place.

    Which brings me back to my original point and question. Is there an add-on or alternative way to maintain the IMAGE tags in Sitemap? Because the current system relies on very strange side-effects and dependencies between the Post page and the Media Library page. My HTML can have different Alt, Text, and Description values than the image will have on the attachment_id= page. And it’s the values on the attachment_id= page that actually get copied into the IMAGE tag in Sitemap.

    This leads to the very strange case where the Post has one set of image values, and the IMAGE tag in Sitemap has a completely different set.

  • Is there an add-on or alternative way to maintain the IMAGE tags in Sitemap?

    No, that’s the way sitemaps work here at WordPress.com, which is why I recommend adding images to your posts using the Add Media button. That will ensure consistency between the tags used in your post and in the sitemap.

  • Rachel, thanks for prompt responses.

  • Rachel, I finally had time to try to insert the image using Add Media. Some minor final issues:

    1) The caption is not centered, in spite of the fact that I have Center selected for the image. The HTML shows that there is an aligncenter value specified for the caption tag, so it must be getting overridden by something else? How do I correct? I saw in other forum threads that inserting a full size image might have this effect, but I don’t understand why it would affect caption.

    2) This then leads to the question: what is the best practice on image sizing when you Add Media? I assumed it would be best to not specify any specific dimension, but always insert full size images. Let the template size it down to the maximum value for that template?

    3) I notice that the sitemap now has the IMAGE tag, great. But the Alt text does not appear there? Most of what I have read suggests that on the HTML page itself the ALT attribute of IMG tag is what search engines use. In the case of the Sitemap, they use the TITLE instead of ALT?

  • Hi there,

    1) The caption is not centered, in spite of the fact that I have Center selected for the image.

    Centering an image does not necessarily center the caption — the ways captions are aligned depends on the theme you’re using. You can find some tips for centering the caption in the Twenty Twelve theme in this forum thread:

    https://en.forums.wordpress.com/topic/twenty-twelve-theme-caption-problem?replies=5#post-1107173

    2) This then leads to the question: what is the best practice on image sizing when you Add Media?

    This depends entirely on your own preferences. :) If you prefer to have smaller images you can size them that way, but if you use full size images your theme will resize them to fit.

    3) I notice that the sitemap now has the IMAGE tag, great. But the Alt text does not appear there?

    No, the alt text is not included in the sitemap. Sitemaps tell search engines when there is a new or updated page on a site, but the search engines will crawl the page itself for more information to include in search results.

  • Okay, it’s all clear. Thanks for help.

  • Just want to make sure I understand the earlier discussion in this thread regarding uploading images to the Media Library. As I understood it, every time I try to update an image by deleting the old one and then re-uploading the file with the same name, WordPress will add a new number to the end of the filename, to make it unique across all uploads of that image during the current month.

    The reason this is very problematic is that you can post something and then want to update the image as you continue to work on the post. This is more true for something like a painting, or an image that has significant production work like a Photoshop or GIF animation. If you are using social media sites like Pinterest or Tumblr to point to the image on WordPress, taking care to enter Alt tags for search engines, you need that name you use to be something authoritative over time. You can’t be changing that filename, because all of the references / pointers to the old filename stay behind on other social media users’ pages.

    Is there any trick I can use on WordPress.com to create a single authoritative URL for an image that will not be modified when I update that image? If the answer is no, then my only option would be to host the images on a different platform?

    If I host the images on a different platform, I lose the ability to either use the “Add Media” button posts, or alternately to “Attach” the image to the Post. If I lose either of those features, I then also lose the ability to have sitemap contain an IMAGE tag for the image.

    Not complaining about any of this, but I do need to understand it. If anything similar to the above is true, then obviously you should never upload anything but a final image and just plan on living with any mistakes in that image forever once you publish and others start to reblog the pointers to that image.

    It does seem like an area WordPress should rethink requirements for. It’s not that uncommon to build links to an image across many pages on a site, and the maintenance overhead to constantly change the URLs every time an image is updated would be a burden.

  • If I host the images on a different platform, I lose the ability to either use the “Add Media” button posts, or alternately to “Attach” the image to the Post. If I lose either of those features, I then also lose the ability to have sitemap contain an IMAGE tag for the image.

    You use the Insert Media – but you insert from the web – that hotlinks to the Media – been a while since I inserted from the web – but as I remember works about like the regular insert – but you need to get the URL of the media exactly right, not the page the media is on.

    Note also that not all hosts like you hotlinking to images on their site.

  • I update media all the time. But I send you the link to the Post or Page the media is on, I NEVER send you the direct link.

    When I change media, I also change the file name, that keeps things straight. I HATE it when I get two files from a site and then I need to spend extra time trying to figure out what file is the good file. I also put a note on the Post or Page with a note about the date and why a change was made.

  • auxclass, just making sure I understand you:

    1) If I want changes to the same image to have the same name and URL over time, I need to host this on another web site.

    2) When pressing the Add Media button, select the “Insert from URL” option and point to it.

    That will maintain the IMAGE link in the sitemap correctly, even though the image is on a foreign site?

    Regarding your other point, I guess you need to consider the use case. If I am sharing images with workers on a team, and we care about versioning, then of course different file names would be helpful, preferably with a version number in the filename.

    But if your application is to simply have the image rank high in Google’s image search, you definitely don’t want the filename changing every time you update the image. And in my example, I might blog on Tumblr or Pinterest with a direct link to the image, and when people reblog that post, they copy over that exact link. I go to update the image and suddenly those old links break. Moreover, it gets hard to have Google count up inbound links to the image because you are splitting those links across different filenames on your site.

  • 1) yes

    2) yes

    I don’t worry about site maps – done here automatically.

    Most of my Media that is changed are printer friendly PDF files, usually the old file is left in place, usually pictures are not changed much, picture changes tend to be when I figured out that I just goofed and a whole new picture is put in place. Usually I will leave the old media in place to not 404 a search engine. sometimes if I know a jerk is hot linking to media of mine I will break the link.

    High search rank for pictures, I just follow advice from Raincoaster & Timethief for major content and I see my pictures rank high on many searches.

    How much I fine tune a picture depends on the use,

  • The topic ‘How Do I Unattach Image from Page?’ is closed to new replies.