hedyorg / hedy

Hedy is a gradual programming language to teach children programming. Gradual languages use different language levels, where each level adds new concepts and syntactic complexity. At the end of the Hedy level sequence, kids master a subset of syntactically valid Python.
https://www.hedy.org
European Union Public License 1.2
1.29k stars 284 forks source link

📜 Allow for extra content for some languages? #5721

Open Felienne opened 2 weeks ago

Felienne commented 2 weeks ago

In addition to #5720, the Chinese content makes would like to create some additional pages for their content, such as:

The main content will include: +Community introduction +Hedy learning documents +Hedy promotional event announcements/notices/reports +Hedy training resources, appointments

I am totally ok with that suggestion, but I am not sure how to practically make that happen, because currently all content exists in all languages and we don’t have support for content only in one language.

Felienne commented 2 weeks ago

Note from @ZoomQuiet in #5720 that is relevant here:

Moreover, although using hostnames is simpler and easier to spread than using parameters in terms of URL, we further envision using cn.hedy.org as the official Chinese community. In addition to being able to directly publish all Chinese content on the official website, we also hope to be able to publish information from each community on our own, such as:

  1. Various activities organized in China cn.hedy/org/events/
  2. Various notes written for China cn.hedy/org/notes/
  3. Voice/video/... materials recorded in the Chinese community cn.hedy/org/sources/
  4. ...

Therefore, official technical cooperation may be required: Use rules such as Nginx to replace all links starting with https://hedy.org/hedy?lang=cn with https://cn.hedy.org/doc, and then point cn.hedy.org to the official Chinese community website we are preparing to release. We generally use the github-pages service to publish, and may need to point the domain name's CNAME to a .github.io domain name.

Felienne commented 2 weeks ago

Just to clarify, the only reason to not do this straight away is that it will be somewhat complex to build, so we need to figure out how to do this properly (such that is can work with existing tools and works for non-technical people too across languages) it is not a matter of not wanting you to have this option.

A very very easy way to get this done quickly is that you setup your own website somewhere (like github pages) and we simply link to it labeling it the official Chinese community site (through something like cn.hedy.org/community) Let me know if that works!

ZoomQuiet commented 2 weeks ago

...

A very very easy way to get this done quickly is that you setup your own website somewhere (like github pages) and we simply link to it labeling it the official Chinese community site (through something like cn.hedy.org/community) Let me know if that works!

This is currently feasible,

but for readers, it feels a bit subtle,

For this reason, we may need to purchase domain names such as cnhedy.org so that readers can feel as close as possible;

of course, linking from the official website to the Chinese community website is an officially recognized behavior, which is absolutely feasible;

please tell us about hedy's decision so that we can grab the domain name in time?

Felienne commented 2 weeks ago

This is currently feasible,

Great, let's explore that path more!

but for readers, it feels a bit subtle,

  • just like you originally wanted to visit google.com,
  • but suddenly jumped to google.github.io,
  • psychologically, you may not trust the new domain name.

Yes, I see! I am sure though that there are methods to keep the original domain name in the address bar while doing a redirect if both domains fiddle with the settings a bit. Can you look into how that could work to increase trust?

ZoomQuiet commented 2 weeks ago

@Felienne this is very easy in Nginx:

This example will automatically replace all URLs of cnhedy.github.io with cn.hedy.org.

The following is a specific Nginx configuration example:

server {
listen 80;
server_name cn.hedy.org;

location / {
# forward the request to cnhedy.github.io
proxy_pass https://cnhedy.github.io;

# modify the HTTP header information to point to cn.hedy.org
proxy_set_header Host $host;
proxy_set_header Referer $scheme://$host;
proxy_set_header Origin $scheme://$host;
}
}

Code explanation:

  1. The server block defines a new Nginx server that listens on port 80 and sets server_name to cn.hedy.org.
  2. The location / block defines how to handle the root path /.
  3. proxy_pass https://cnhedy.github.io; forwards the request to the cnhedy.github.io website.
  4. proxy_set_header Host $host; modifies the Host field in the HTTP request header to point to cn.hedy.org. This is to ensure that the backend server can correctly identify the requested domain name.
  5. proxy_set_header Referer $scheme://$host; and proxy_set_header Origin $scheme://$host; modify the Referer and Origin fields in the HTTP request header to also point to cn.hedy.org. This is to ensure that the backend server can correctly identify the source of the request.

Effect verification:

  1. Visit cn.hedy.org in the browser, you should be able to see the content of the cnhedy.github.io website, but the URL shows cn.hedy.org.

  2. Check the browser's developer tools, you should be able to see that the Host, Referer, and Origin fields in the HTTP request header have been changed to cn.hedy.org.

Reference source:

If you configure it on the official website, you need to

PS: The current prototype website is published at:

https://cn-hedy-org.github.io/site/

Because it is published using the github organization repository, there is an extra site/ repository directory.

You can also complete all automatic proxies by referring to the Nginx official documentation; Of course, other modern web servers have this proxy function, and you can refer to the corresponding documentation for configuration;

Felienne commented 2 weeks ago

Thanks for the detailed info! We will discuss this in our next contributors meeting on Tuesday (feel free to drop in if you want/can (2PM CET)

ZoomQuiet commented 2 weeks ago

Thanks for the detailed info! We will discuss this in our next contributors meeting on Tuesday (feel free to drop in if you want/can (2PM CET)

i'll try join, but can not make sure now.

thanx for all,

this issue, can usage all others country's community support.

jpelay commented 5 days ago

Hello @ZoomQuiet! We were debating about this issue in the last couple of meetings and came to a proposal for you guys!

We can provide you with a HTML template that you can edit as you'd like. The link to access this template would be something like: cn.hedy.org/community In order to edit this template you would upload PRs to our repo which in turn would be approved by us.

Does this proposal work for you?

ZoomQuiet commented 5 hours ago

Hello @ZoomQuiet! We were debating about this issue in the last couple of meetings and came to a proposal for you guys!

We can provide you with a HTML template that you can edit as you'd like. The link to access this template would be something like: cn.hedy.org/community In order to edit this template you would upload PRs to our repo which in turn would be approved by us.

Does this proposal work for you?

No problem, My understanding is:

So, how will such webpages be published? Or should I use my previous solution? Can I use various services like ghithub-pages to publish them in other domain names, After being reviewed by hedy.org, then use a reverse proxy like nginx to forward them to the cn.hedy.org domain name?