Skip to content

Commit dbe5f45

Browse files
committed
Use base_url correctly
Signed-off-by: Crola1702 <[email protected]>
1 parent f1e1e80 commit dbe5f45

File tree

8 files changed

+24
-25
lines changed

8 files changed

+24
-25
lines changed

Rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22
preprocess do
3-
config[:base_url] = ENV.fetch('INFRA_BASE_URL', '')
3+
config[:base_url] = ENV['INFRA_BASE_URL'] ? "/#{ENV['INFRA_BASE_URL']}" : ''
44
end
55

66
# Individual pages

content/projects/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="col-xs-12 col-sm-6 col-md-4 py-2">
55
<div class="card">
66
<a href="<%= project.identifier.without_ext %>">
7-
<img src="/images/<%= project[:logo] %>" alt="<%= project[:title] %> logo" class="card-img-top logo">
7+
<img src="<%= @config[:base_url] %>/images/<%= project[:logo] %>" alt="<%= project[:title] %> logo" class="card-img-top logo">
88
<div class="card-body">
99
<h5 class="card-title"><%= project[:title] %></h5>
1010
<p class="card-text"><%= project[:description] %></p>
@@ -14,4 +14,4 @@
1414
</div>
1515
<% end %>
1616
</div>
17-
</div>
17+
</div>

content/team/crola1702.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ urls:
1212
- https://robotics.stackexchange.com/users/32494/cristobal-arroyo
1313
---
1414
Cristóbal is a PMC member of the Infrastructure project, and a maintainer of the ROS 2 and Gazebo buildfarms.
15-
He is also a member of the buildfarmers, and maintainer of [buildfarm-tools](https://github.com/osrf/buildfarm-tools).
15+
He is also a member of the buildfarmers, and maintainer of [buildfarm-tools](https://github.com/osrf/buildfarm-tools).

content/team/index.html.erb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
<% @items.find_all('/team/*.md').each do |member| %>
44
<div class="col-xs-12 col-sm-6 col-md-4 py-2">
55
<div class="card">
6-
<a href="<%= member.identifier.without_ext %>">
7-
<%= parse_markdown_link member[:picture], :image, "card-img-top" %>
8-
<div class="card-body">
9-
<h5 class="card-title"><%= member[:name] %></h5>
10-
<h6 class="card-subtitle mb-2 text-muted">PMC <%= member[:role] %></h6>
11-
<p><b>Username:</b> <%= member[:username] %></p>
12-
<p><b>Affiliation:</b> <%= parse_markdown_link member[:affiliation], :link %></p>
13-
</div>
14-
</a>
6+
<a href="<%= @config[:base_url] %><%= member.identifier.without_ext %>">
7+
<%= parse_markdown_link member[:picture], :image, "card-img-top", @config[:base_url] %>
8+
<div class="card-body">
9+
<h5 class="card-title"><%= member[:name] %></h5>
10+
<h6 class="card-subtitle mb-2 text-muted">PMC <%= member[:role] %></h6>
11+
<p><b>Username:</b> <%= member[:username] %></p>
12+
<p><b>Affiliation:</b> <%= parse_markdown_link member[:affiliation], :link %></p>
13+
</div>
1514
</a>
1615
</div>
1716
</div>
1817
<% end %>
1918
</div>
20-
</div>
19+
</div>

layouts/default.erb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
</head>
1717
<body>
1818
<nav class="navbar navbar-dark bg-dark navbar-expand-md p-2">
19-
<a class="navbar-brand" href="/">
19+
<a class="navbar-brand" href="<%= @config[:base_url] %>">
2020
<img src="<%= @config[:base_url] %>/images/ros-infrastructure.jpg" width="50" height="50" alt="Infrastructure logo">
2121
</a>
2222
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
2323
<span class="navbar-toggler-icon"></span>
2424
</button>
2525
<div class="collapse navbar-collapse" id="navbarNav">
2626
<div class="navbar-nav">
27-
<a class="nav-item nav-link active" href="/projects">Projects</a>
28-
<a class="nav-item nav-link active" href="/team">Team</a>
29-
<a class="nav-item nav-link active" href="/documentation">Documentation</a>
30-
<a class="nav-item nav-link active" href="/repos">Repositories</a>
31-
<a class="nav-item nav-link active" href="/#how-to-contribute">Contribute</a>
27+
<a class="nav-item nav-link active" href="<%= @config[:base_url] %>/projects">Projects</a>
28+
<a class="nav-item nav-link active" href="<%= @config[:base_url] %>/team">Team</a>
29+
<a class="nav-item nav-link active" href="<%= @config[:base_url] %>/documentation">Documentation</a>
30+
<a class="nav-item nav-link active" href="<%= @config[:base_url] %>/repos">Repositories</a>
31+
<a class="nav-item nav-link active" href="<%= @config[:base_url] %>/#how-to-contribute">Contribute</a>
3232
<a class="nav-item nav-link active" href="https://status.openrobotics.org">status.openrobotics.org</a>
3333
</div>
3434
</div>

layouts/project.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
<%= yield %>
1010
<p>For more information check <a href="<%= @item[:docs_url] %>"><%= @item[:title] %> Documentation</a></p>
1111
</div>
12-
</div>
12+
</div>

layouts/team-member.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<h1 class="page-title"><%= @item[:name] %></h1>
55
</div>
66
<div class="row">
7-
<%= parse_markdown_link @item[:picture], :image, "member-picture" %>
7+
<%= parse_markdown_link @item[:picture], :image, "member-picture", @config[:base_url] %>
88
</div>
99
<div class="row">
1010
<%= yield %>
@@ -24,4 +24,4 @@
2424
</dl>
2525
</div>
2626
</div>
27-
</div>
27+
</div>

lib/helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
def parse_markdown_link(link_str, format=:link, html_classes="")
1+
def parse_markdown_link(link_str, format=:link, html_classes="", img_base_url="")
22
regex_match = /\[(.*)\]\((.*)\)/.match link_str
33
case format
44
when :link
55
"<a class='#{html_classes}' href='#{regex_match[2]}' alt='#{regex_match[1]}'>#{regex_match[1]}</a>"
66
when :image
7-
"<img class='#{html_classes}' src='#{regex_match[2]}' alt='#{regex_match[1]}'>"
7+
"<img class='#{html_classes}' src='#{img_base_url}#{regex_match[2]}' alt='#{regex_match[1]}'>"
88
end
99
end

0 commit comments

Comments
 (0)