-2

I want to add alt text for all images that are included from TYPO3 backend using typoscript.

<img title="ABC" alt="....." src="fileadmin/uploads/abc/nature.jpg">

Please share if anyone have answer regarding this.

Vimal Usadadiya
  • 442
  • 2
  • 10

1 Answers1

0

You can automatically add alt text for all images uploaded by fal or by rte using below typoscript code in template setup file.

temp.altText >
temp.altText < tt_content.image.20.1.altText
tt_content.image.20.1.altText >
tt_content.image.20.1.altText.cObject = COA
tt_content.image.20.1.altText.cObject {
    10 < temp.altText
    20 = TEXT
    20 {
        noTrimWrap = | | |
        data = file:current:name
    }
}

if you want to add page title in alt text of images then use below code

temp.altText >
temp.altText < tt_content.image.20.1.altText
tt_content.image.20.1.altText >
tt_content.image.20.1.altText.cObject = COA
tt_content.image.20.1.altText.cObject {
    10 < temp.altText
    20 = TEXT
    20 {
        noTrimWrap = | | |
        data = page:title
    }
}
Vivek Parmar
  • 773
  • 1
  • 10
  • 26