Skip to content

Commit 71131a7

Browse files
committed
feat: content-contribute-cta: Add "Edit this page" link
Adds an "Edit this page" link to the content contribute CTA, linking to the GitHub.dev editor for direct content modification. Also, adds page_context to the content contribute CTA partial.
1 parent d2340ba commit 71131a7

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

layouts/blog/single.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
<div class="mt-16">
2323
{{ partial "components/content-contribute-cta.html" (dict
24+
"page_context" .
2425
"icon" "solid pen-to-square"
2526
"title" "Have an idea? <span class=\"gradient-text\">Share your voice.</span>"
2627
"description" "Open Neuromorphic is a community-driven platform. We invite you to share your research, tutorials, or insights by writing a blog post."

layouts/neuromorphic-hardware/single.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
</div>
2525
<div class="max-w-4xl mx-auto mt-12 mb-16">
2626
{{ partial "components/content-contribute-cta.html" (dict
27+
"page_context" .
2728
"icon" "solid microchip"
2829
"title" "Help Us <span class=\"gradient-text\">Improve this Guide</span>"
2930
"description" "Our hardware guide is community-maintained. If you know of a chip we should add, see an error, or have updated information, please let us know by opening an issue on our GitHub repository."
3031
"link" "https://github.com/open-neuromorphic/open-neuromorphic.github.io/issues/new/choose"
31-
"link_text" "Suggest an Edit on GitHub"
32+
"link_text" "Open an Issue"
3233
) }}
3334
</div>
3435
{{ partial "components/share-cta.html" . }}

layouts/neuromorphic-software/single.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
{{ partial "software/related-events.html" $relatedContent }}
2323

2424
{{ partial "components/content-contribute-cta.html" (dict
25+
"page_context" .
2526
"icon" "solid code"
2627
"title" "Help Improve this <span class='gradient-text'>Software Guide</span>"
2728
"description" "Our software guide is maintained by the community. If you have updates, see an error, or want to suggest a new tool, please let us know by opening an issue on our GitHub repository."
2829
"link" "https://github.com/open-neuromorphic/open-neuromorphic.github.io/issues/new/choose"
29-
"link_text" "Suggest an Edit on GitHub"
30+
"link_text" "Open an Issue"
3031
) }}
3132

3233
<div class="mt-8">

layouts/partials/components/content-contribute-cta.html

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
{{ $page_context := .page_context }}
12
{{ $icon := .icon | default "solid pen-to-square" }}
23
{{ $title := .title | default "Have an idea? <span class=\"gradient-text\">Share your voice.</span>" }}
34
{{ $description := .description | default "Open Neuromorphic is a community-driven platform. We invite you to share your research, tutorials, or insights with a global audience of neuromorphic enthusiasts." }}
45
{{ $link := .link | default "/getting-involved/" }}
56
{{ $link_text := .link_text | default "Learn How to Contribute" }}
7+
{{ $is_external_link := hasPrefix $link "http" }}
68

79
<div class="p-8 rounded-lg bg-theme-light dark:bg-darkmode-theme-light shadow-lg">
810
<div class="flex flex-col md:flex-row items-center text-center md:text-left gap-8">
@@ -17,9 +19,25 @@ <h2 class="text-3xl font-bold mb-2">
1719
<p class="text-lg text-gray-600 dark:text-gray-400 mb-4">
1820
{{ $description | markdownify }}
1921
</p>
20-
<a href="{{ $link | relLangURL }}" class="btn btn-new-primary">
21-
{{ $link_text }}
22-
</a>
22+
<div class="mt-4 flex flex-wrap gap-4 items-center justify-center md:justify-start">
23+
<a href="{{ if not $is_external_link }}{{ $link | relLangURL }}{{ else }}{{ $link }}{{ end }}"
24+
class="btn btn-new-primary"
25+
{{ if $is_external_link }}target="_blank" rel="noopener"{{ end }}>
26+
{{ $link_text }}
27+
</a>
28+
29+
{{ with $page_context }}
30+
{{ if and .IsPage .File }}
31+
{{ with .File.Path }}
32+
{{ $dev_url := printf "https://github.dev/open-neuromorphic/open-neuromorphic.github.io/blob/main/content/%s" . }}
33+
<a href="{{ $dev_url }}" target="_blank" rel="noopener" class="btn btn-new-outline">
34+
Edit this page
35+
{{ partial "icon.html" (dict "style" "solid" "name" "arrow-up-right-from-square" "class" "ml-1.5 h-3.5 w-3.5") }}
36+
</a>
37+
{{ end }}
38+
{{ end }}
39+
{{ end }}
40+
</div>
2341
</div>
2442
</div>
2543
</div>

layouts/partials/event-single-layout.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
<div class="lg:col-12 mt-16">
3131
{{ partial "components/content-contribute-cta.html" (dict
32+
"page_context" .
3233
"icon" "solid chalkboard-user"
3334
"title" "Inspired? <span class=\"gradient-text\">Share your work.</span>"
3435
"description" "Share your expertise with the community by speaking at a workshop, student talk, or hacking hour. It's a great way to get feedback and help others learn."

0 commit comments

Comments
 (0)