Skip to content

Commit cc7a35f

Browse files
vdyedscho
andcommitted
Migrate the 'Documentation' landing page to Hugo
This moves the information about the videos to the pages themselves, and adjusts the landing page so that Hugo renders it as desired. The video part of the logic is complicated enough to require functionality that Hugo does not offer in `content/` pages; That part is refactored into the `videos` shortcode, where the functionality _is_ available. Co-authored-by: Johannes Schindelin <[email protected]> Signed-off-by: Victoria Dye <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5722d44 commit cc7a35f

File tree

8 files changed

+99
-56
lines changed

8 files changed

+99
-56
lines changed

config/initializers/constants.rb

-10
This file was deleted.

content/doc/_index.html

+14-46
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<% @section = "documentation" %>
2-
<% @page_title = "Git - Documentation" %>
3-
4-
<% content_for :sidebar do %>
5-
<% end %>
1+
---
2+
section: "documentation"
3+
title: "Git - Documentation"
4+
url: /doc.html
5+
aliases:
6+
- /doc/index.html
7+
---
68

79
<div id="main">
810

@@ -11,7 +13,7 @@ <h1> Documentation </h1>
1113
<h2> Reference </h2>
1214

1315
<div class="callout ref-manual">
14-
<h3><%= link_to "Reference Manual", docs_path %></h3>
16+
<h3><a href="/docs">Reference Manual</a></h3>
1517

1618
<p>
1719
The official and comprehensive <strong>man pages</strong> that are included in the Git package itself.
@@ -21,9 +23,9 @@ <h3><%= link_to "Reference Manual", docs_path %></h3>
2123
<p class="quickref">
2224
Quick reference guides:
2325

24-
<%= link_to "GitHub Cheat Sheet", "https://github.github.com/training-kit/" %>
26+
<a href="https://github.github.com/training-kit/">GitHub Cheat Sheet</a>
2527
|
26-
<%= link_to "Visual Git Cheat Sheet", "https://ndpsoftware.com/git-cheatsheet.html" %>
28+
<a href="https://ndpsoftware.com/git-cheatsheet.html">Visual Git Cheat Sheet</a>
2729

2830
</p>
2931

@@ -36,53 +38,19 @@ <h3>Pro Git</h3>
3638
Dead tree versions are available on <a href="https://www.amazon.com/Pro-Git-Scott-Chacon/dp/1484200772?ie=UTF8&camp=1789&creative=9325&creativeASIN=1430218339&linkCode=as2&tag=git-sfconservancy-20">Amazon.com</a>.
3739
</p>
3840
</div>
39-
41+
4042
<h2> Videos </h2>
4143

4244
<div>
43-
44-
<% groups = @videos[0,4].group_by { |i| i[0] % 2 } %>
45-
46-
<div class="two-column">
47-
<div class="column-left">
48-
<ul class="video-thumbnails">
49-
<% groups[1].each do |video| %>
50-
<li>
51-
<%= link_to image_tag("video/ep#{video[0]}.png"), "/video/#{ video[4] }" %>
52-
<h4>
53-
<%= link_to video[3], "/video/#{ video[4] }" %>
54-
</h4>
55-
<p class="description">
56-
<strong>Length:</strong> <%= video[5] %>
57-
</p>
58-
</li>
59-
<% end %>
60-
</ul>
61-
</div>
62-
<div class="column-right">
63-
<ul class="video-thumbnails">
64-
<% groups[0].each do |video| %>
65-
<li>
66-
<%= link_to image_tag("video/ep#{video[0]}.png"), "/video/#{ video[4] }" %>
67-
<h4>
68-
<%= link_to video[3], "/video/#{ video[4] }" %>
69-
</h4>
70-
<p class="description">
71-
<strong>Length:</strong> <%= video[5] %>
72-
</p>
73-
</li>
74-
<% end %>
75-
</ul>
76-
</div>
77-
</div>
45+
{{< videos >}}
7846

7947
<p>
80-
<%= link_to "See all videos →", "/videos" %>
48+
<a href="/videos">See all videos →</a>
8149
</p>
8250

8351
<h2> External Links </h2>
8452
<p>
85-
The <%= link_to "External Links section", "/doc/ext" %> is a curated, ever-evolving collection of tutorials, books, videos, and other Git resources.
53+
The <a href="/doc/ext">External Links section</a> is a curated, ever-evolving collection of tutorials, books, videos, and other Git resources.
8654
</p>
8755

8856
</div>

content/video/_index.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
redirect_to: videos
3+
---

content/video/get-going.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
section: "documentation"
3+
video_title: "Get Going with Git"
4+
category: "Git Basics"
5+
length: "04:26"
6+
link: "get-going"
7+
ext_id: "41493906"
8+
episode: 3
9+
---

content/video/quick-wins.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
section: "documentation"
3+
video_title: "Quick Wins with Git"
4+
category: "Git Basics"
5+
length: "05:06"
6+
link: "quick-wins"
7+
ext_id: "41516942"
8+
episode: 4
9+
---

content/video/what-is-git.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
section: "documentation"
3+
video_title: "What is Git?"
4+
category: "Git Basics"
5+
length: "08:15"
6+
link: "what-is-git"
7+
ext_id: "41381741"
8+
episode: 2
9+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
section: "documentation"
3+
video_title: "What is Version Control?"
4+
category: "Git Basics"
5+
length: "05:59"
6+
link: "what-is-version-control"
7+
ext_id: "41027679"
8+
episode: 1
9+
---

layouts/shortcodes/videos.html

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{{ $videos := sort (where .Site.RegularPages "Params.episode" "ne" nil) "Params.episode" }}
2+
{{ $img_suffix := "" }}
3+
{{ $dimensions := "" }}
4+
{{ if .IsNamedParams }}
5+
{{ $img_suffix = .Get "img_suffix" }}
6+
{{ $dimensions = .Get "dimensions" }}
7+
{{ end }}
8+
9+
<div class="two-column">
10+
<div class="column-left">
11+
<ul class="video-thumbnails">
12+
{{ range $i, $video := $videos }}
13+
{{ $group := mod $i 2 }}
14+
{{ if eq $group 1 }}
15+
<li>
16+
<a href="{{ relURL "video" }}/{{ $video.Params.link }}"><img src="{{ relURL "images/video" }}/ep{{ print $video.Params.episode $img_suffix }}.png" {{ $dimensions }}></a>
17+
<h4>
18+
<a href="{{ relURL "video" }}/{{ $video.Params.link }}">{{ $video.Params.video_title }}</a>
19+
</h4>
20+
<p class="description">
21+
<strong>Length:</strong> {{ $video.Params.length }}
22+
</p>
23+
</li>
24+
{{ end }}
25+
{{ end }}
26+
</ul>
27+
</div>
28+
<div class="column-right">
29+
<ul class="video-thumbnails">
30+
{{ range $i, $video := $videos }}
31+
{{ $group := mod $i 2 }}
32+
{{ if eq $group 0 }}
33+
<li>
34+
<a href="{{ relURL "video" }}/{{ $video.Params.link }}"><img src="{{ relURL "images/video" }}/ep{{ print $video.Params.episode $img_suffix }}.png" {{ $dimensions }}></a>
35+
<h4>
36+
<a href="{{ relURL "video" }}/{{ $video.Params.link }}">{{ $video.Params.video_title }}</a>
37+
</h4>
38+
<p class="description">
39+
<strong>Length:</strong> {{ $video.Params.length }}
40+
</p>
41+
</li>
42+
{{ end }}
43+
{{ end }}
44+
</ul>
45+
</div>
46+
</div>

0 commit comments

Comments
 (0)