Skip to main content
Participant
May 17, 2022
Question

SVG Layer name changes not working

  • May 17, 2022
  • 3 replies
  • 1022 views

Hello,

I have been trying to change the layers in my Illustrator file so that the changes reflect in my SVG after export, but then I open the SVG and all the layers are reverted back to their original names. I could change them successfully before, but it has since stopped working, and I am at a total loss as to why it won't update anymore. Any ideas?

 

NOTE: I am exporting under Save As > SVG because the SVG options under Export jumble the code in a difficult-to-read format for our developer.

 

This is my Ai file with the proper layer names:

 

This is my exported SVG when opened in Illustrator:

 

This topic has been closed for replies.

3 replies

m1b
Community Expert
Community Expert
May 17, 2022

Hi @RachelWillingham, just to give you another avenue to explore, here is script for exporting the active document as Web Optimized SVG. You can play with the different save options properties by uncommenting the lines that I have commented (lines that start with "//"). I did a quick test and the settings I have export the SVG objects as XML elements with a "data-name" attribute that is the layer/item name in Illustrator.

- Mark

 

var doc = app.activeDocument,
    options = new ExportOptionsWebOptimizedSVG(),
    exportFolderPath = Folder.desktop + '/SVG Testing/';

options.artboardRange = '';
// options.artboardRange = '1-3';
options.coordinatePrecision = 3;
options.fontType = SVGFontType.SVGFONT;
// options.fontType = SVGFontType.OUTLINEFONT;
options.cssProperties = SVGCSSPropertyLocation.ENTITIES;
// options.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;
// options.cssProperties = SVGCSSPropertyLocation.STYLEATTRIBUTES;
// options.cssProperties = SVGCSSPropertyLocation.STYLEELEMENTS;
options.rasterImageLocation = RasterImageLocation.EMBED;
// options.rasterImageLocation = RasterImageLocation.LINK
// options.rasterImageLocation = RasterImageLocation.PRESERVE
options.saveMultipleArtboards = true;
options.svgId = SVGIdType.SVGIDMINIMAL;
// options.svgId = SVGIdType.SVGIDREGULAR;
// options.svgId = SVGIdType.SVGIDUNIQUE;
options.svgMinify = false;
options.svgResponsive = false;

var exportFolder = Folder(exportFolderPath);
if (!exportFolder.exists)
    exportFolder.create();

doc.exportFile(exportFolder, ExportType.WOSVG, options);
Participating Frequently
May 18, 2022

Could it possibly be your preference is checked for Identify Objects By: XML ID? 

Srishti Bali
Community Manager
Community Manager
May 17, 2022

Hi @RachelWillingham 

 

Thanks for reaching out. We have recently released an update Ai 26.3.1. Please update to the latest build using this link - Check for the latest update and let us know if that helps to resolve the issue. 

 

Regards,

Srishti

Participant
May 17, 2022

Hi,

I updated Illustrator and it did not resolve any of the issues I have been having.

 

Thanks

Anshul_Saini
Community Manager
Community Manager
May 23, 2022

Hi @RachelWillingham,

 

Thanks for confirming that. We have logged a bug with the product teams, and they are investigating the issue. You may try the following workarounds till the time this issue gets fixed:

  • Downgrade to Ai v26.0.3

  • Clean re-install the app, but the issue resurfaces after some time.

 

We appreciate your patience and would request you to please be patient and stay tuned for the updates.

 

Thanks & Regards,

Anshul Saini

Participant
May 17, 2022

Hello,

The SVG that I have exported has a bunch of extra numbers added to the Group ID in the code, and I can't figure out how to prevent that. My developer and I are thinking that it may be a buffer to prevent duplicate ID names, but we have tried different layer names in the Ai file and it is still adding the numbers.

 

There have been a few instances where there are no extra numbers added to the end, and I can't figure out what is different between the layers.

 

We are at a loss, so any help or insight would be appreciated!

 

EXAMPLE: This image illustrates the extra numbers added to the code, and a few instances when there are not any extra numbers added (under "Back View").