Alt text templates and variables
Build alt text from the post title, categories, tags and file name with ByteKeel PixTag template variables, with examples.
What a template is
A template is a line of text with placeholders. ByteKeel PixTag fills the placeholders in for each image. It lives under ByteKeel PixTag › Settings › Template Settings and is used when Generation Method is Context-aware or Hybrid.
Variables you can use
%filename%— the file name with hyphens and underscores turned into spaces and numbers removed, in Title Case%posttitle%— the title of the post, page or product the image was uploaded to%category%— all of that post’s categories, separated by commas%tag%— all of that post’s tags, separated by commas%author%— the post author’s display name%date%— the post date, for example “March 15, 2024”%postexcerpt%— the post excerpt (or the start of the content if there is no excerpt). It works although it is not listed on the settings screen.%sitetitle%— your site name
Which post counts
Post variables come from the post the image is attached to — the one you were editing when you uploaded it. Images uploaded straight to Media › Add New Media File, or picked from the library rather than uploaded, are not attached to anything. For those, only %filename% and %sitetitle% have a value; every other variable is simply removed.
Examples
%filename% → Product Image
%posttitle% %filename% → WordPress Guide Hero Banner
%category% image: %filename% → Tutorial Image: Screenshot
%filename% from %sitetitle% → Team About Us From Northline
Results are converted to Title Case, as above. Keep the template short: everything is cut to the character limit.
Tips
- Avoid separators that can be left hanging. With
%posttitle% - %filename%, an unattached image becomes “- Hero Banner”. A plain space between variables avoids that. - A template of just
%posttitle%gives every image the post title when it is attached, and falls back to the file name when it is not. - Categories and tags can be long lists. Use them only on sites where posts have one or two of each.
Did this answer the question? No — open a support request