Demo:Gallery/Standard gallery using parameter captionproperty
From semantic-mediawiki.org

Please consider adopting examples to fit your environment since simple duplication may not create appropriate results.
Data presented on this page are for educational and demonstration purpose only.
Caption as a page type property[edit]
{{ #ask: [[Has captionproperty::+]] | ?Has captionproperty | format=gallery | captionproperty=Has captionproperty }}
Caption as a string type property[edit]
{{ #ask: [[Has captionproperty (string)::+]] | ?Has captionproperty (string) | format=gallery | captionproperty=Has captionproperty (string) }}