1

When uploading multiple images using Batch upload, there is no ability to add alt text at once. Is there a way to allow/add distance alt text to multiple images during upload without having to open and edit each item? Can we achieve this using SPE?

1

1 Answer 1

3

Simpler Way:

You can put $name to the alt field in the standard value of an image /sitecore/templates/System/Media/Unversioned/Image/__Standard Values. This way if content authors forget to fill the alt field during upload or in the case of batch upload, it is pre-filled with the file name.

Sitecore Powershell way:

The above method will work for future uploads but if you want to populate the alt tags for already media files, you can run below powershell script:

$mediaItemContainer = Get-Item "master:/sitecore/media library/MyImages"
    $items = $mediaItemContainer.Axes.GetDescendants() | Where-Object { $_.TemplateID -ne [Sitecore.TemplateIDs]::MediaFolder -and $_.Fields["Alt"] -ne $null } | Initialize-Item
    
foreach($item in $items) {
        if(-not($item."Alt")) {
           $item.Editing.BeginEdit()
           $item.Fields["Alt"].Value = $item.Name
           $item.Editing.EndEdit() }
        }
3
  • Thank you. This solved the issue. But client is looking for the classic upload which we used to have earlier. Mar 2 at 10:18
  • See this thread to move to classic upload in media library : sitecore.stackexchange.com/questions/8880/… Mar 2 at 10:45
  • Hi Raman, I followed this thread and tried setting up the sc_fv cookie value to 9.0.0. Even tried to delete them. I created a custom pipeline to do the same. But this doesn't seem to work. Any guidance would be helpful Mar 3 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.