Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: add "EditOnGitHub" on every necessary page #3971

Merged
merged 3 commits into from
Jul 16, 2021
Merged

improve: add "EditOnGitHub" on every necessary page #3971

merged 3 commits into from
Jul 16, 2021

Conversation

SEWeiTung
Copy link
Contributor

@SEWeiTung SEWeiTung commented Jul 11, 2021

Here's the 1st version (Deprecated now, just keep for history):

mainIndex

downloadLTS

downloadCur~~

@SEWeiTung
Copy link
Contributor Author

@Trott and @XhmikosR : What do you think of this change? This change will let you show what you change in both windows and linux, as well as add more "Edit On GitHub" on possible pages.

@XhmikosR
Copy link
Contributor

The separator isn't even needed because those are permalinks so they use forward slashes.

As for the change itself, I can't really comment on it. I like simple things and this is something I personally don't like.

@SEWeiTung
Copy link
Contributor Author

SEWeiTung commented Jul 12, 2021

Now after my deep thoughts in both UI and codes, I've changed by moving a GitHub icon onto the header, just like what others' website by GitHub. It looks more beautiful and practical:

MainEng

For diff language, it has the default tooltip:
MainChina

Here's the missing download part:
Download

Codes look simple but useful, easy to understand ;)

@SEWeiTung
Copy link
Contributor Author

Ping @nodejs/website : Any other ideas on it? I'll leave it for some days for your suggestions.

@nickserv
Copy link
Contributor

Maybe this could go in a footer or sidebar.

@SEWeiTung
Copy link
Contributor Author

SEWeiTung commented Jul 12, 2021

Maybe this could go in a footer or sidebar.

Thanks for your suggestion, many website pages on GitHub has a link on its head, and to be more clear, GitHub's icon is better:)

Take React as an example:
image

or sidebar.

Can you point out where to put by circuling in red with a screenshot here ;)

const sep = require('path').sep
// add suffix (".html" or sep for windows test) to each part of regex
// to ignore possible occurrences in titles (e.g. blog posts)
const isEditable = `(security|index).html|(about|download|docs|foundation|get-involved|knowledge)\\${sep}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't see why this is needed. These are permalinks, so they will always use / regardless of the OS.

Copy link
Contributor Author

@SEWeiTung SEWeiTung Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for Linux and other systems (exclude windows), the original codes work perfectly. However as you see, if for windows (I'm now working on Win, and because it uses '' instead of '/' as the path sep, so I cannot see the result right or not according to '/' in the gitHubLink.js (because nothing would be found and replaced).

So in order to be compatable with all the platforms, sep is a better choice IMO :)

Or maybe any good other ideas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. Are you viewing it with a file: URL or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott and @XhmikosR : No. what I mean is: if we do tests on Windows, because the "files" in "scripts\plugins\githubLinks.js" will have the spe = "", however the original filtering condition is something like "downloads/", this means for windows platform, we cannot get the result (we cannot see "Edit on GitHub" on the locally running test page).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I explained it to you... these are links. They will always use /. This is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XhmikosR : I see you mean for the output files, yes, they will always use "/", but on windows platform in gitHhubLinks.js, you'll never get any files to be coped with, because windows is using "", this means if you using "npm run serve", you will never see the result of "Edit on GitHub" on the page, and you don't know what you did is right or not.

So considering those who are using windows, I have to use spe instead of hard code here. You can have a try on windows, if you hard coded, then you know why I changed to this :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these are links so they will always use / regardless of OS. That is why it is working all this time just fine.

@nickserv
Copy link
Contributor

I guess there isn't a sidebar on most pages, but the header and footer could work. React is a good example, and we already have a Google Translate button in the header anyway.

@SEWeiTung
Copy link
Contributor Author

I guess there isn't a sidebar on most pages, but the header and footer could work. React is a good example, and we already have a Google Translate button in the header anyway.

Yes, that's also what I think now by just putting it beside the Mul-language icon :)

@Trott
Copy link
Member

Trott commented Jul 13, 2021

Nothing against GitHub, but I'm not excited about prominently featuring a company's logo on all webpages like that. I just removed the GitHub mark from docs a few days ago. nodejs/node#39251

@SEWeiTung
Copy link
Contributor Author

Nothing against GitHub, but I'm not excited about prominently featuring a company's logo on all webpages like that. I just removed the GitHub mark from docs a few days ago. nodejs/node#39251

Sorry I didn't notice it....I'll change it to "Edit on GitHub" as a link and put it there.

@SEWeiTung
Copy link
Contributor Author

SEWeiTung commented Jul 13, 2021

default.mp4

@Trott
Copy link
Member

Trott commented Jul 13, 2021

Sounds good to me. Anyone looking at this more closely want to review it?

@silverwind
Copy link
Contributor

silverwind commented Jul 15, 2021

I don't think that button should be in the header. I'd put it into into the footer instead, besides Report Node.js issue, without an icon.

@SEWeiTung
Copy link
Contributor Author

I don't think that button should be in the header. I'd put it into into the footer instead, besides Report Node.js issue, without an icon.

Since @silverwind and @nickmccurdy have ideas to put it in the footer.... I've changed to this following:

  1. For a normal English version:
    English

  2. For a non-English version:
    Jap

  3. For some page (such as blog), you will never see the result:
    dontallowedit

  4. For those who don't translate it into English, it will use English in default:
    Ariab

@SEWeiTung SEWeiTung merged commit cf0873f into nodejs:master Jul 16, 2021
@SEWeiTung SEWeiTung deleted the fixEditOnGit branch July 16, 2021 10:30
@XhmikosR
Copy link
Contributor

@MaledongGit I still don't get why you use path.sep. We are 100% sure there will not be a \ present, there's no reason to complicate things...

Secondly, why do we even need the new JS at all? We have already access to the page path in metalsmith,

This shouldn't have landed IMHO.

@XhmikosR XhmikosR mentioned this pull request Dec 20, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants