Redefine the indexing output command locally, instead of globally, so that it outputs whatever you give it instead of \thepage, while all other indexes are unaffected.
A combination reference:

a plain reference

or, more helpfully:

or even a mixed hierarchy perhaps:

Here we are using imakeidx and xindy, and running with shell-escape.
Anything outputting as a structure (e.g., s\thesection) would need a matching Xindy format-parser defined (what Xindy calls define-location-class) for Xindy to be able to interpret it (example maps to: alphabet, null separator, arabic/roman numbers).
MWE
%--- \begin{filecontents*}[overwrite]{mal-style.xdy} ;;; Load a predefined style: ;(require "makeindex.xdy") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-attributes ("squarebr")) (markup-attribute-group-list :sep "; ") (markup-locref :attr "squarebr" :open "[\colorbox{yellow!40}{\hyperpage{" :close "}}]") ;(markup-locref :class "page-numbers" :attr "definition" ; :open "{\bf " :close "}") ;(markup-locref :class "page-numbers" :attr "definition" ; :open "\textbf{" :close "}") ;(define-letter-groups ; ("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" ; "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")) ; ;(markup-letter-group-list :sep "~n\indexspace") ;(define-letter-group "ly" :after "l" :before "m") ;(define-letter-group "ny" :after "n" :before "o") ; ;(markup-letter-group :open-head "~n {\bf " :close-head "}" ; :capitalize) ;(define-location-class "appendices" ; ("ALPHA" :sep "-" "arabic-numbers") ; :hierdepth 2) ;(markup-locref-list :sep "; " :depth 0 :class "appendices") ;(markup-locref-list :open "~~" :sep ", " :depth 1 :class "appendices") ;(define-alphabet "bible-chapters" ; ("Genesis" "Exodus" "Leviticus" "Numbers" "Deuteronomy" ; ... )) ;(define-location-class "bible-verses" ; ("bible-chapters" :sep " " "arabic-numbers" :sep "," "arabic-numbers")) ; (define-letter-groups ("")) ;(define-letter-group "z") (markup-locclass-list :open ": ") (define-letter-group "Α" ; Greek alpha :prefixes ("α");\x0391") :after "Z" ) ;(define-letter-groups ("Num" "Dtn" "Ps")) ;(define-letter-group "Greek" ; :prefixes ("α" "ω") ; :after "Z") ;%(markup-letter-group [:open string] [:close string] [:group group-name] ;% [:open-head string] [:close-head string] ;% [:upcase | :downcase | :capitalize]) ;% ; \\begingroup ; \\setlength{\\fboxsep}{5pt}% ; \\colorbox{blue}{% ; \\color{white}\\large\\sffamily\\bfseries ; \\hbox to \\dimexpr\\linewidth-2\\fboxsep{% ; \\hfill (markup-letter-group :open-head "~n {\setlength{\fboxsep}{5pt}\sffamily\bfseries\large\colorbox{blue!30}{\textcolor{yellow!90!red!5}{\hbox to \dimexpr\linewidth-2\fboxsep{ \hfill " ; space is needed :close-head "\hfill}}\nopagebreak\vspace{2mm}}}" ) ;(markup-letter-group ; :open-head "~n {\sffamily\bfseries\colorbox{blue};;;;{\textcolor{yellow}{" ; :close-head "}}}" ; ) (markup-locclass-list :open "\dotfill" :sep "") (define-attributes (("texttt" "textsc" "myown")) ) (markup-locref :attr "textbf" :open "\textbf{\hyperpage{" :close "}}") (markup-locref :attr "textit" :open "\textit{\hyperpage{" :close "}}") (markup-locref :attr "texttt" :open "\texttt{\hyperpage{" :close "}}") (markup-locref :attr "textsc" :open "\textsc{\hyperpage{" :close "}}") (markup-locref :attr "myown" :open "\myown{\hyperpage{" :close "}}") (markup-locref :attr "hyperpage" :open "\hyperpage{" :close "}") (markup-locref :attr "default" :open "\hyperpage{" :close "}") (merge-rule "n" "X" :again) \end{filecontents*} %--- \begin{filecontents*}[overwrite]{general-aindex.xdy} (define-alphabet "secalpha" ("s" "p")) (define-location-class "section-index" :var ("secalpha" :sep "" "arabic-numbers" :sep "-" "secalpha" :sep "" "arabic-numbers" :sep ", " )) (markup-locclass-list :open "\dotfill " :sep ", " :close "") (define-attributes (("sectionmark" "sectionmarky")) ) (markup-locref :attr "sectionmark" :open "\textbf{\S}" :close "") (markup-locref :attr "sectionmarky" :open "\colorbox{yellow}{\textbf{\S}" :close "}") \end{filecontents*} \documentclass{article} \usepackage{xcolor} \usepackage{fontspec} \setmainfont{Noto Serif} \usepackage[hyperindex=false,colorlinks]{hyperref} %\usepackage{splitidx} \usepackage{imakeidx} \usepackage{xparse} \ExplSyntaxOn \makeatletter \NewDocumentCommand { \generalindex } { o m m } { \IfValueTF {#1} { { % Local redefinition of indexentry to #3 instead of page% \renewcommand{\imki@wrindexentrysplit}[3]{% \expandafter\protected@write\csname##1@idxfile\endcsname{}% {\string\indexentry{##2}{#3}}% }% \index[#1]{#2} } } { } } \makeatother \NewDocumentCommand { \indexsec } { m } { \generalindex[sec]{#1}{s\thesection-p\thepage} } \NewDocumentCommand { \indexsecb } { m } { \generalindex[secb]{#1}{\thesection} } \NewDocumentCommand { \indexsecc } { m } { \generalindex[secc]{#1|sectionmark}{\thesection} } \NewDocumentCommand { \genindex } { m m m } { \generalindex[#1]{#2}{#3} } \ExplSyntaxOff \makeindex[title=Xindy--demo, program=texindy, options= -M mal-style.xdy -C utf8 -t secondary.ilg , columnseprule, ] \makeindex[name=s,title=Statutes, program=texindy, options= -M mal-style.xdy -C utf8 , columnseprule, ] \makeindex[name=sec, title={IndexA Xindy {\small\\ by section}}, program=texindy, options=-M general-aindex.xdy -C utf8 -t \jobname aidx.ilg , ] \makeindex[name=secb, title={IndexB Xindy {\small\\ by section only}}, program=texindy, options=-M general-aindex.xdy -C utf8 -t secb.ilg , ] \makeindex[name=secc, title={IndexC Xindy {\small\\ by section, with section-mark applied}}, program=texindy, options=-M general-aindex.xdy -C utf8 -t secc.ilg , ] \makeindex[name=secd, title={IndexD Xindy {\small\\ mixture of reference types}}, program=texindy, options=-M general-aindex.xdy -C utf8 -t secd.ilg , columns=1, ] %===== \newcommand{\secindex}[1]{\textbf{#1}\indexsec{#1}} \newcommand{\secbindex}[1]{\indexsecb{#1}} \newcommand{\seccindex}[1]{\indexsecc{#1}} \newcommand\yellowcommand[1]{{\sffamily\textbf{#1}}} \begin{document} % from tex.se: \def\myshift#1{\makebox[0pt][r]{\texttt{--}}\texttt{#1}} \def\myown#1{{\Huge#1}} \def\mycommand#1{{\color{green}#1}} \def\mydef#1{\texttt{\makebox[0pt][r]{\char"5C}#1}} \def\mymath#1{{\color{blue}$#1$}} \def\myfavorite#1{{\color{cyan}\makebox[0pt][r]{I $\heartsuit$\ }{\color{cyan}#1}}} \section{My section}\label{mysection} I refer to my section~\ref{mysection}. Start. Nunc ligula faucibus\index{xindy|textbf}. \newpage \index{vector@Vector} \index{runme@\mycommand{runme}} \newpage \index{asquared@\mymath{a^2}} \index{bsquared@\mymath{b^2}} \newpage x \newpage \index{csquared@\mymath{c^2}} \index{roof|myown} \newpage \index{mal@\myshift{mal}} \index{nature@\textbf{Nature}} \newpage \index{home!my own 1} \index{home!my own 2} \newpage \index{definition@\mydef{definition}} \index{Velocity} Nullarutrum porttitor... \newpage \index{alcohol}\index{beauty}\index{älf}\index{zero} \newpage x\index{vectors@\myfavorite{vectors}} x\index{roof|myown} \newpage x\index{roof} % additions: x\index{αβγ} \newpage x\index{10.2.250.1} x\index{10.12.250.12} \newpage x\index{60.12.250.12} x\index{128.12.250.12} \newpage x\index{128.12.250.12} x\index[s]{s 7}x\index[s]{s 7B}x\index[s]{s 50}x\index[s]{s 5}x\index[s]{s 3(2)(a)} \newpage x\index[s]{SOGA!s 7}x\index[s]{SOGA!s 7B}x\index[s]{SOGA!s 50}x\index[s]{SOGA!s 5}x\index[s]{SOGA!s 3(2)(a)} x\index[s]{Vsort!V-sort!V128} x\index[s]{Vsort!V-sort!V64} x\index[s]{SOGA!s 3(12)(a)} x\index{first level!second level!third level} x\index{xfirst level!xsecond level!xthird level|textbf} \newpage x\index{xfirst level!xsecond level|textit} \newpage x\index{xfirst level|squarebr} %--------------------------------------------------- \section{Model} x\secindex{model} x\secbindex{model} x\seccindex{model} y\genindex{secd}{model!amain section@\yellowcommand{main section}|sectionmarky}{\thesection} y\genindex{secd}{model!details!intro}{p\thepage} \section{Hypothesis} x\secindex{hypothesis} x\secbindex{hypothesis} x\seccindex{hypothesis} \section{Testing} x\secindex{testing} x\secbindex{testing} \newpage x\seccindex{testing} \section{Methodology} x\secindex{methodology} \newpage x\secbindex{methodology} x\seccindex{methodology} y\genindex{secd}{model!details!causative}{p\thepage} \newpage \section{Experiment} x\secindex{experiment} x\secbindex{experiment} x\seccindex{experiment} \newpage y\genindex{secd}{model!details!error margin}{p\thepage} \newpage \section{Results} x\secindex{results} x\secbindex{results} x\seccindex{results} y\genindex{secd}{model!details!error margin}{p\thepage} \newpage y\genindex{secd}{model!details!error margin}{p\thepage} \section{Conclusions} x\secindex{conclusions} x\secbindex{conclusions} x\seccindex{conclusions} \section{Acknowledgements} x\secindex{acknowledgements} x\secbindex{acknowledgements} x\seccindex{acknowledgements} %--------------------------------------------------- \printindex \printindex[s] \printindex[sec] \printindex[secb] \printindex[secc] \printindex[secd] \end{document}