Skip to content

Commit 26d0b1f

Browse files
feat: add github edit btn (#1822)
Co-authored-by: Sebastian Beltran <[email protected]>
1 parent 34a18e8 commit 26d0b1f

File tree

8 files changed

+60
-4
lines changed

8 files changed

+60
-4
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
22

33
gem 'github-pages', group: :jekyll_plugins
44
gem 'webrick'
5-
5+
gem 'jekyll-github-metadata'

Gemfile.lock

+1
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ PLATFORMS
273273

274274
DEPENDENCIES
275275
github-pages
276+
jekyll-github-metadata
276277
webrick
277278

278279
BUNDLED WITH

_config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
url: "https://expressjs.com"
22
baseurl: "/"
33

4+
repository: expressjs/expressjs.com
5+
46
# Site settings
57

68
defaults:
@@ -19,6 +21,7 @@ announcement: false # Enable or disable the announcements.
1921

2022
plugins:
2123
- jekyll-redirect-from
24+
- jekyll-github-metadata
2225

2326
highlighter: rouge
2427
# library used for syntax highlighting
@@ -34,6 +37,3 @@ exclude:
3437
- [uk/CHANGELOG.md]
3538
- vendor/bundle
3639
- node_modules/
37-
38-
39-
github: [metadata]

_layouts/3x-api.html

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ <h3 id="sidebar-heading" class="toc-heading"><em>On this page</em></h3>
1616
</nav>
1717
<main>
1818
{{ content }}
19+
<a role="button" class="edit-github-btn" href="{{ site.github.repository_url }}/tree/gh-pages/_includes/{{page.menu}}/en/3x" aria-label="GitHub button">
20+
<span class="hidden-dark">
21+
{% include icons/github-light.svg %}
22+
</span>
23+
<span class="hidden-light">
24+
{% include icons/github-dark.svg %}
25+
</span>
26+
Edit this page</a>
1927
</main>
2028
</div>
2129

_layouts/4x-api.html

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ <h3 id="sidebar-heading" class="toc-heading"><em>On this page</em></h3>
1616
</nav>
1717
<main>
1818
{{ content }}
19+
<a role="button" class="edit-github-btn" href="{{ site.github.repository_url }}/tree/gh-pages/_includes/{{page.menu}}/en/4x" aria-label="GitHub button">
20+
<span class="hidden-dark">
21+
{% include icons/github-light.svg %}
22+
</span>
23+
<span class="hidden-light">
24+
{% include icons/github-dark.svg %}
25+
</span>
26+
Edit this page</a>
1927
</main>
2028
</div>
2129

_layouts/5x-api.html

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ <h3 id="sidebar-heading" class="toc-heading"><em>On this page</em></h3>
1616
</nav>
1717
<main>
1818
{{ content }}
19+
<a role="button" class="edit-github-btn" href="{{ site.github.repository_url }}/tree/gh-pages/_includes/{{page.menu}}/en/5x" aria-label="GitHub button">
20+
<span class="hidden-dark">
21+
{% include icons/github-light.svg %}
22+
</span>
23+
<span class="hidden-light">
24+
{% include icons/github-dark.svg %}
25+
</span>
26+
Edit this page</a>
1927
</main>
2028
</div>
2129

_layouts/page.html

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828
<div class="content">
2929
<main>
3030
{{ content }}
31+
<a role="button" class="edit-github-btn" href="{{ site.github.repository_url }}/edit/gh-pages/{{ page.path }}" aria-label="GitHub button">
32+
<span class="hidden-dark">
33+
{% include icons/github-light.svg %}
34+
</span>
35+
<span class="hidden-light">
36+
{% include icons/github-dark.svg %}
37+
</span>
38+
Edit this page</a>
3139
</main>
3240
</div>
3341
{% endif %}

css/style.css

+23
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,25 @@ html[xmlns] .clearfix {
557557
color: var(--box-fg);
558558
}
559559

560+
a.edit-github-btn{
561+
display: flex;
562+
gap: 0.5rem;
563+
align-items: center;
564+
width: fit-content;
565+
padding: 0.5rem;
566+
border-radius: 0.3rem;
567+
568+
span {
569+
height: 20px;
570+
}
571+
572+
&:is(:hover, :active, :focus) {
573+
color: var(--fg);
574+
background-color: var(--hover-bg);
575+
outline: 1px solid var(--card-fg);
576+
}
577+
}
578+
560579
#mobile-menu {
561580
display: none;
562581
position: relative;
@@ -1381,6 +1400,10 @@ strong.eol {
13811400
display: block;
13821401
}
13831402

1403+
.hidden-light {
1404+
display: none;
1405+
}
1406+
13841407
blockquote {
13851408
margin-left: 0;
13861409
font-weight: 600;

0 commit comments

Comments
 (0)