Skip to content

Commit

Permalink
Update nav bar to support links from metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
toddkummer committed Oct 9, 2024
1 parent e17f51a commit 637963a
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 13 deletions.
Empty file added src/_components/shared/.keep
Empty file.
2 changes: 0 additions & 2 deletions src/_components/shared/navbar.erb

This file was deleted.

5 changes: 0 additions & 5 deletions src/_components/shared/navbar.rb

This file was deleted.

8 changes: 8 additions & 0 deletions src/_data/site_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ description: >-
Rockridge Solutions is a boutique software consulting firm that has been helping clients tell
the story of their businesses for 20 years. Let Todd and John leverage the power of Ruby on
Rails to help tell your story.
menu:
# home:
# - name: Blog
# url: "/posts"
post:
- name: Rockridge Solutions
url: "/"
2 changes: 1 addition & 1 deletion src/_layouts/default.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%= render "head", metadata: site.metadata, title: data.title %>
</head>
<body class="<%= data.layout %> <%= data.page_class %> postcard">
<%= render Shared::Navbar.new(metadata: site.metadata, resource: resource) %>
<%= render "navbar", links: site.metadata.menu[data.layout] %>

<main class="main container">
<%= yield %>
Expand Down
15 changes: 13 additions & 2 deletions src/_layouts/post.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
layout: default
---

<h1><%= data.title %></h1>
<section class="hero is-small">
<div class="hero-body">
<p class="title has-text-white"><%= data.title %></p>
<p class="subtitle has-text-white"><%= data.subtitle %></p>
</div>
</section>

<%= yield %>
<section class="section">
<article class="box">
<div class="content">
<%= yield %>
</div>
</article>
</section>
6 changes: 3 additions & 3 deletions src/_partials/_head.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<meta property="og:description" content="<%= resource.data.og_description %>">
<meta property="og:image" content="<%= resource.data.og_image %>">
<link rel="stylesheet" href="<%= asset_path :css %>" />
<link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
<script src="<%= asset_path :js %>" defer></script>
<%= live_reload_dev_js %>
14 changes: 14 additions & 0 deletions src/_partials/_navbar.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<nav class="navbar is-primary has-shadow" role="navigation" aria-label="main navigation">

<%# is-active prevents the menu from disappearing < 1024px %>
<%# container keeps the menu within the same boundaries as the main content %>
<div class="navbar-menu is-active container">
<div class="navbar-end">
<% (links || []).each do |link| %>
<a class="navbar-item has-text-white has-text-weight-bold" href="<%= link.url %>">
<%= link.name %>
</a>
<% end %>
</div>
</div>
</nav>

0 comments on commit 637963a

Please sign in to comment.