function referenceLink = getReferenceLink(hp)
    referenceLink = '';
    if ~strcmp(hp.command, 'doc')
        hp.getDocLinks;
    end
    if hp.commandIsHelp
        if ~isempty(hp.docLinks.referencePage)
            referenceLink = getString(message('MATLAB:helpUtils:displayHelp:ReferencePageFor', hp.getTopic));
            if hp.wantHyperlinks
                referenceLink = helpUtils.formatHelpTextLine(helpUtils.createMatlabLink('doc', hp.docLinks.referencePage, referenceLink));
            else
                referenceLink = helpUtils.createMatlabCommandWithTitle(hp.wantHyperlinks, referenceLink, 'doc', hp.docLinks.referencePage);
            end
        end
        
        if ~isempty(hp.docLinks.productName)
            productLink = getString(message('MATLAB:helpUtils:displayHelp:DocumentationFor', hp.docLinks.productName));
            if hp.wantHyperlinks
                productLink = helpUtils.formatHelpTextLine(helpUtils.createMatlabLink('doc', hp.getTopic, productLink));
            else
                productLink = helpUtils.createMatlabCommandWithTitle(hp.wantHyperlinks, productLink, 'doc', hp.getTopic);
            end
            
            referenceLink = append(referenceLink, productLink);
        end
    end
end

