microsoft / pxt

Microsoft MakeCode (PXT - Programming eXperience Toolkit)
https://makecode.com
MIT License
2.07k stars 578 forks source link

Conditional page content for viewing modes #8685

Open Sheila111 opened 2 years ago

Sheila111 commented 2 years ago

Describe the bug A useless link in Docs page

Steps to reproduce the behavior 1.Navigate to https://arcade.makecode.com/beta#editor 2.Help--->Docs--->Game Design Concepts--->Walking Hero 3.Click the link "Open this tutorial in the editor!"

Actual behavior A useless link in Docs page. There shows a blank page after clicking the link "Open this tutorial in the editor!" 1

Additional context 1.OS: Windows10 2.arcade version: 1.8.12 3.Microsoft MakeCode version: 7.4.18

ganicke commented 2 years ago

This "useless link" works when the page is served as document: https://arcade.makecode.com/concepts/walking-hero. The sidedoc view needs to open the linked page in a _blank target or just strip the link whilst in sidedocs.

ganicke commented 2 years ago

@shakao - sorry to bother, but do you have any ideas about linkouts in sidedocs?

shakao commented 2 years ago

hmmm ok so it looks like we're using /#tutorial:/concepts/walking-hero which is fine when the base URL is arcade.makecode.com/docs but when we load our sidedocs, the base url is something like https://arcade.makecode.com/---docs which makes the relative URL wrong. and also yeah, it's not opening in a new window so even if the URL was correct it wouldn't work

i THINK there's no content-only solution for this since these links are all generated from markdown; longer term either stripping the link or adding target=_blank would work, but probably not super urgent since this bug also repros on live?

ganicke commented 2 years ago

Block it out for rendering somehow when in not in document view?:

### ~ docview

[Open this tutorial in the editor!](/#tutorial:/concepts/walking-hero)

### ~

-- or --

some kind of conditional rendering:

### $if @docs

[Open this tutorial in the editor!](/#tutorial:/concepts/walking-hero)

### $elseif @sidedocs

**Run this as a tutorial from the Home Screen**

### $else