Skip to content

Commit

Permalink
Merge pull request #9 from upmaru/feature/seo-meta-tags
Browse files Browse the repository at this point in the history
Feature/seo meta tags
  • Loading branch information
zacksiri authored Jan 3, 2025
2 parents 6def6f6 + cc5b092 commit f6ea8a0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/opsmaru_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ defmodule OpsmaruWeb do
# Shortcut for generating JS commands
alias Phoenix.LiveView.JS

alias OpsmaruWeb.Robot
# Routes generation with the ~p sigil
unquote(verified_routes())
end
Expand Down
16 changes: 14 additions & 2 deletions lib/opsmaru_web/components/layouts/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<meta name="theme-color" content="#0f172a" />
<%= if assigns[:canonical_url] && Robot.enable_indexing?(@conn) do %>
<meta property="og:url" content={@canonical_url} />
<link rel="canonical" href={@canonical_url} />
<% end %>
<meta
name="robots"
content={if Opsmaru.Robot.enable_indexing?(@conn), do: "index", else: "noindex"}
property="og:description"
content={assigns[:page_description] || "Deploy and monetize your web application."}
/>
<meta
name="description"
content={assigns[:page_description] || "Deploy and monetize your web application."}
/>
<meta property="og:type" content={assigns[:page_type] || "website"} />
<meta name="robots" content={if Robot.enable_indexing?(@conn), do: "index", else: "noindex"} />
<link rel="apple-touch-icon" sizes="180x180" href={~p"/site/images/apple-touch-icon.png"} />
<link rel="icon" type="image/png" sizes="32x32" href={~p"/site/images/favicon-32x32.png"} />
<link rel="icon" type="image/png" sizes="16x16" href={~p"/site/images/favicon-16x16.png"} />
Expand All @@ -19,6 +29,8 @@
<.live_title>
{assigns[:page_title] || "Opsmaru"}
</.live_title>
<meta property="og:title" content={assigns[:page_title] || "Opsmaru"} />
<meta property="og:image" content={assigns[:page_cover] || ~p"/site/images/default-shot.png"} />
<link
rel="stylesheet"
href="https://api.fontshare.com/css?f%5B%5D=switzer@400,500,600,700&amp;display=swap"
Expand Down
2 changes: 1 addition & 1 deletion lib/opsmaru/robot.ex → lib/opsmaru_web/robot.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Opsmaru.Robot do
defmodule OpsmaruWeb.Robot do
def enable_indexing?(conn) do
not String.contains?(conn.host, "preview") && config(:indexing)
end
Expand Down
Binary file added priv/static/images/default-shot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f6ea8a0

Please sign in to comment.