Packages

Framework for Phoenix applications to optimize your site for search engines and displaying rich results when your URLs are shared across the internet.

Current section

Files

Jump to
Raw

mix.exs

if File.exists?("blend/premix.exs") do
Code.compile_file("blend/premix.exs")
end
defmodule SEO.MixProject do
use Mix.Project
@version "0.3.1"
def project do
[
app: :phoenix_seo,
name: "SEO",
version: @version,
elixir: ">= 1.17.0",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
compilers: compilers(Mix.env()),
aliases: aliases(),
deps: deps(),
docs: docs(),
homepage_url: "https://hexdocs.pm/phoenix_seo",
source_url: "https://github.com/dbernheisel/phoenix_seo",
package: package(),
description:
"Framework for Phoenix applications to optimize your site for search engines and displaying rich results when your URLs are shared across the internet."
]
|> Keyword.merge(maybe_lockfile_option())
end
def cli do
[preferred_envs: [tests: :test]]
end
# `:seo_jsonld` materializes the SEO.JSONLD.* modules for THIS library's own
# ExDoc site (:dev) and tests (:test). Dependencies always compile in :prod,
# so gating it out of :prod is what keeps those generated modules from landing
# in consumers' builds — where they'd clash with a consumer that also runs the
# compiler. See config/config.exs for the `:all` vocabulary used here.
defp compilers(:prod), do: Mix.compilers()
defp compilers(_), do: Mix.compilers() ++ [:seo_jsonld]
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
def elixirc_paths(:test), do: ["lib", "test/support"]
def elixirc_paths(_), do: ["lib"]
defp package do
[
name: "phoenix_seo",
files: [
"lib",
"priv/schemaorg.jsonld",
"priv/wrappers",
"priv/examples",
"mix.exs",
"CHANGELOG*",
"README*",
"LICENSE*"
],
maintainers: ["David Bernheisel"],
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/dbernheisel/phoenix_seo",
"Readme" => "https://github.com/dbernheisel/phoenix_seo/blob/#{@version}/README.md",
"Changelog" => "https://github.com/dbernheisel/phoenix_seo/blob/#{@version}/CHANGELOG.md"
}
]
end
defp docs do
[
main: "SEO",
formatters: ["html"],
assets: %{"assets" => "assets"},
logo: "priv/logomark-small.png",
source_ref: @version,
groups_for_modules: groups_for_modules(),
extras: ["CHANGELOG.md", "LICENSE"]
]
end
defp groups_for_modules do
[
Domains: [
SEO.JSONLD,
SEO.OpenGraph,
SEO.Site,
SEO.Twitter,
SEO.Facebook,
SEO.Unfurl
],
"Open Graph": [
SEO.OpenGraph.Article,
SEO.OpenGraph.Audio,
SEO.OpenGraph.Book,
SEO.OpenGraph.Image,
SEO.OpenGraph.Profile,
SEO.OpenGraph.Video
],
LLMs: [
SEO.LLMs,
SEO.LLMs.Entry,
SEO.LLMs.Provider
],
Protocol: [
SEO.JSONLD.Build,
SEO.OpenGraph.Build,
SEO.Site.Build,
SEO.Twitter.Build,
SEO.Facebook.Build,
SEO.Unfurl.Build
],
"JSON-LD (Google rich results)": json_ld_google_modules(),
"JSON-LD (Schema.org)": [~r/^SEO\.JSONLD\..+/]
]
end
defp json_ld_google_modules do
~w[
Article BreadcrumbList Course Dataset DiscussionForumPosting
EmployerAggregateRating Event FAQPage ImageObject JobPosting
LocalBusiness MathSolver Movie Organization Product ProfilePage
QAPage Quiz Recipe Review SoftwareApplication SpeakableSpecification
VacationRental VideoObject
]
|> Enum.map(&Module.concat([SEO.JSONLD, &1]))
|> Enum.concat([
SEO.JSONLD.Actions,
SEO.JSONLD.Breadcrumbs,
SEO.JSONLD.FAQ
])
|> Enum.sort()
end
defp aliases do
[
tests: ["format --check-formatted", "credo --strict", "test"]
]
end
defp deps do
[
{:phoenix_live_view, "~> 1.0"},
# Dev / Test
{:blend, "~> 0.4", only: [:dev, :test]},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:jump_credo_checks, "~> 0.1.0", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.27", only: :dev, warn_if_outdated: true, runtime: false},
{:jason, "~> 1.0", only: [:dev, :test]},
{:floki, "~> 0.35", only: [:dev, :test]},
{:makeup_eex, "~> 2.0", only: :dev, runtime: false},
{:makeup_html, "~> 0.2", only: :dev, runtime: false}
]
end
defp maybe_lockfile_option do
case System.get_env("MIX_LOCKFILE") do
nil -> []
"" -> []
lockfile -> [lockfile: lockfile]
end
end
end