QuantEcon / quantecon-book-theme

A Jupyter Book Theme for QuantEcon Book Style Projects
BSD 3-Clause "New" or "Revised" License
40 stars 20 forks source link

Clicking on "view source" produces a 404 #202

Closed jstac closed 1 year ago

jstac commented 1 year ago

CC @mmcky @AakashGfude

mmcky commented 1 year ago

@jstac I am going to move this issue to the quantecon-book-theme repo.

jstac commented 1 year ago

Background: This was opened in the continous time mc lecture series issue tracker, which is where the bug occcured. I haven't noticed it in other lecture series, which is why I opened it there.

AakashGfude commented 1 year ago

Ooh no. Will prioritize this.

HengchengZhang commented 1 year ago

Hi @AakashGfude, I've attached all my findings here as discussed. I hope this could help.

The thing is that when we click on the view source button, it actually forms an URL in the form: <li data-tippy-content="View Source"><a target="_blank" href="{{ theme_repository_url }}{{github_sourcefolder}}/{{ sourcename }}" download><i data-feather="github"></i></a></li>

I found this in quantecon-book-theme/quantecon_book_theme/layout.html.

The part github_sourcefolder will give us a directory in github.

Usually, since we are pointing to a blob object, this part should be /blob/main/lectures.

But in our URLs, what we get from this part is /tree/master/lectures.

(In continuous_time_mcs it is /tree/master/ctmc_lectures and the ctmc_lectures directory doesn't exist)

Attached below are all the URLs generated by clicking view source in all python-related repositories in QuantEcon.

https://github.com/QuantEcon/lecture-python-intro/tree/master/lectures/intro.md
https://github.com/QuantEcon/lecture-python.myst/tree/master/lectures/intro.md
https://github.com/QuantEcon/lecture-python-programming.myst/tree/master/lectures/intro.md
https://github.com/QuantEcon/lecture-python-advanced.myst/tree/master/lectures/intro.md
https://github.com/QuantEcon/lecture-datascience.myst/tree/main/lectures/index.md
https://github.com/jstac/continuous_time_mcs/tree/master/ctmc_lectures/intro.md

The thing is that the difference between /blob and /tree doesn't really matter because GitHub will auto-correct this.

(Of course it would be better if we can be more specific)

But there's a difference with master and main as they are completely differet branches.

GitHub can auto-correct master to main but not the other way.

(That's another reason why we are getting 404 in continuous_time_mcs).

AakashGfude commented 1 year ago

Thanks @HengchengZhang for the detailed description. Although, I am not able to replicate it locally or online, for example in https://python.quantecon.org/intro.html , View Source produces links with blob. Is it happening for you locally?

HengchengZhang commented 1 year ago

Thanks @AakashGfude for look into this, you can right click on the GitHub icon and paste it somewhere else to get the original link.

If left click it, the new link will be autocorrect by GitHub in the new page.

AakashGfude commented 1 year ago

Ahh yup. Got it. Thanks @HengchengZhang