Inkscape.org
Beginners' Questions Href object attribute converted from relative to absolute on copy and paste
  1. #1
    salcis salcis @salcis

    When I copy and paste an object with a relative Href attached to it (e.g. ../bar/index.html) I end up with an absolute Href (e.g. file:///home/me/foo/bar/index.html). Is there a way of retaining the relative Href?

  2. #2
    inklinea inklinea @inklinea⛰️

    If you click on the image and then Edit>XML Editor

    There is an icon to "duplicate node" as show in the attached image.

    Note: sometimes it is greyed out in the XML Editor.

    If it is greyed out just click the nearest element in the XML Editor then click back on the image entry.

    It should duplicate without changing the href path.

    Screenshot From 2024 04 17 15 24 50
  3. #3
    inklinea inklinea @inklinea⛰️

    In fact that was more complicated than necessary.

    Edit>Duplicate does the same thingΒ  !

  4. #4
    salcis salcis @salcis

    I should have been clearer - I am copying and pasting multiple objects between documents . You are right duplicating an object within a document keeps the relative Href.

  5. #5
    inklinea inklinea @inklinea⛰️

    I have tested on windows.

    If you hit Ctrl + s to save the file after pasting, it seems to update to a relative path.

  6. #6
    salcis salcis @salcis

    I'm using Inkscape 1.3.2 (Fedora/Linux) and that's not the behaviour I'm getting. Pasting changes the path from relative to absolute and it remains absolute after saving.

    Attached graphic may make clearer the behaviour I'm seeing and what I'm trying to achieve (let me know if it clarifies things!)

  7. #7
    inklinea inklinea @inklinea⛰️

    I get the correct behaviour (same as windows) in Ubuntu 22 with Inkscape 1.3

    Can you check if you have Edit>Preferences>Imported Images>Store Absolute Filepath For Linked Images is unchecked ?Β 

    Otherwise the solution would be to raise and issue on gitlab

    Or write an extension to compare current svg filepath with link filepath and rewrite to relative.

  8. #8
    salcis salcis @salcis

    That set me on the right path, thanks. "Store absolute path" was unchecked, but it made me try importing rather than copy/paste. Importing maintains the relative paths. I can maintain all my objects that have Hrefs on a separate page and then import that page into other pages as needed. Thanks again!

Inkscape Inkscape.org Inkscape Forum Beginners' Questions Href object attribute converted from relative to absolute on copy and paste