Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:36:4

On a straight path.  

on a (‘alā is semantically connected to the preceding ˹statement˺) straight path, that is, ˹you follow˺ the way of the prophets before you, ˹enjoining˺ the affirmation of God’s Oneness and guidance (the emphasis expressed by the oath ˹in ‘by the definitive Qur’ān’˺ and the remainder ˹of the statement˺ is a response to the disbelievers’ saying to him, ‘You have not been sent ˹by God˺!’ ˹Q. 13:43˺.
القرآن:٣٦:٤

عَلَىٰ صِرَاطٍ مُسْتَقِيمٍ  

(على) متعلق بما قبله (صراط مستقيم) أي طريق الأنبياء قبلك التوحيد والهدى، والتأكيد بالقسم وغيره رد لقول الكفار له "لست مرسلا".

See similar narrations below:

Collected by Qurʾān
quran:4:68

And We would have guided them to a straight path.  

And We would have guided them to a straight path. Some Companions said to the Prophet (s): ‘How will we be able to see you in Paradise, when you will be in the highest stations and we will be lower than you?’, and so the following was revealed:
القرآن:٤:٦٨

وَلَهَدَيْنَاهُمْ صِرَاطًا مُسْتَقِيمًا  

{ولهديناهم صراطا مستقيما} قال بعض الصحابة للنبي ﷺ كيف نراك في الجنة وأنت في الدرجات العلى ونحن أسفل منك فنزل.