All Projects β†’ hlongvu β†’ phoenix_meta_tags

hlongvu / phoenix_meta_tags

Licence: MIT license
Phoenix library helps generating meta tags for website.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to phoenix meta tags

Craft Seomatic
SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
Stars: ✭ 135 (+440%)
Mutual labels:  meta, tags
Seo Helper
πŸ” SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization).
Stars: ✭ 262 (+948%)
Mutual labels:  meta, tags
audio-tag-analyzer
Extracts metadata music metadata found in audio files
Stars: ✭ 18 (-28%)
Mutual labels:  meta, tags
Laravel Meta
HTML Meta Tags management package available for for Laravel 5.*
Stars: ✭ 150 (+500%)
Mutual labels:  meta, tags
sms blitz
Send SMS messages through multiple different providers
Stars: ✭ 29 (+16%)
Mutual labels:  phoenix
Awesome-meta-tags
πŸ“™ Awesome collection of meta tags
Stars: ✭ 18 (-28%)
Mutual labels:  meta
node-taglib2
A rewrite of the now unmaintained node-taglib
Stars: ✭ 40 (+60%)
Mutual labels:  tags
fastHistory
A python tool connected to your terminal to store important commands, search them in a fast way and automatically paste them into your terminal
Stars: ✭ 24 (-4%)
Mutual labels:  tags
radiopush
Create communities and share songs with Spotify users (https://radiopush.app)
Stars: ✭ 89 (+256%)
Mutual labels:  phoenix
Spectra
Spectra is a multi-purpose, for-fun and for-utility Discord bot!
Stars: ✭ 101 (+304%)
Mutual labels:  tags
Cometary
Roslyn extensions, with a touch of meta-programming.
Stars: ✭ 31 (+24%)
Mutual labels:  meta
cometa
Lightweight, header-only C++14 metaprogramming library. Pattern matching, compile-time stuffs and algorithms (arrays, type information (CTTI), string manipulation), 'value-or-errorcode' union-like type, type for passing named arguments, useful constexpr functions and many more. (MIT license)
Stars: ✭ 56 (+124%)
Mutual labels:  meta
alternate
Plug and Phoenix helpers to localize your web app via the URL
Stars: ✭ 26 (+4%)
Mutual labels:  phoenix
phoenix passwordless login
Phoenix Passwordless Login
Stars: ✭ 28 (+12%)
Mutual labels:  phoenix
gringotts payment
Demo Phoenix app showing gringotts payment library integrations.
Stars: ✭ 24 (-4%)
Mutual labels:  phoenix
google scraper live view
Application for extracting large amounts of data from the Google search results page
Stars: ✭ 17 (-32%)
Mutual labels:  phoenix
phoenix-queryserver
Apache Phoenix Query Server
Stars: ✭ 33 (+32%)
Mutual labels:  phoenix
AutoTags
ζ ‡η­Ύθ‡ͺεŠ¨η”Ÿζˆζ’δ»Ά For Typecho
Stars: ✭ 53 (+112%)
Mutual labels:  tags
html-meta-tags
Inspired/stolen from http://code.lancepollard.com/complete-list-of-html-meta-tags/
Stars: ✭ 116 (+364%)
Mutual labels:  metatags
live dj
πŸ’Ώ Join or create video playlists to share a real-time experience with others! 🎧
Stars: ✭ 19 (-24%)
Mutual labels:  phoenix

Phoenix Meta Tags

Module Version Hex Docs Total Download License Last Updated

This is a library helps generate meta tags for a website.

Default Usage

From a struct like this:

%{
    title: "Phoenix Title",
    description: "Phoenix Descriptions",
    url: "https://phoenix.meta.tags",
    image: "https://phoenix.meta.tags/logo.png"
}

will become:

# Default tags
<title>Phoenix Title</title>
<meta content="Phoenix Title" name="title">
<meta content="Phoenix Descriptions" name="description">

#Open Graph tags
<meta content="website" property="og:type">
<meta content="https://phoenix.meta.tags" property="og:url">
<meta content="Phoenix Title" property="og:title">
<meta content="Phoenix Descriptions" property="og:description">
<meta content="https://phoenix.meta.tags/logo.png" property="og:image">

#Twitter tags
<meta content="summary_large_image" name="twitter:card">
<meta content="https://phoenix.meta.tags" name="twitter:url">
<meta content="Phoenix Title" name="twitter:title">
<meta content="Phoenix Descriptions" name="twitter:description">
<meta content="https://phoenix.meta.tags/logo.png" name="twitter:image">

Advanced Usage

Other key value of tags map will be rendered individually by key. Nested map will be rendered by flat-representation of keys. For example:

map = %{
  title: "Phoenix Title",
  description: "Phoenix Descriptions",
  url: "https://phoenix.meta.tags",
  image: "https://phoenix.meta.tags/logo.png",
  fb: %{
    name: "facebook",
    size: %{
      width: 100,
      height: 200,
      position: %{
        x: 10,
        y: 15
      }
    }
  }
}

In addition to default tags like above example, the rendered tags will have more:

<meta content="facebook" property="fb:name">
<meta content=100 property="fb:size:width">
<meta content=200 property="fb:size:height">
<meta content=10 property="fb:size:position:x">
<meta content=15 property="fb:size:position:y">

Instead of a nested map, you can also use a string-key map, this also delivers the same result:

map = %{
  "title" => "PhoenixTags",
  "fb:name" => "facebook",
  "fb:size:width" => 100,
  "fb:size:height" => 200,
  "fb:size:position:x" => 10,
  "fb:size:position:y" => 15
}

Tag Value Override

In default rendering, the og:title tag will get value from title. If you re-define og:title value, the new value will be override the default title value. For example:

map = %{
  title: "Phoenix Title",
  og: %{
    title: "Override"
  }
}

Will have output:

<title>Phoenix Title</title>
<meta content="Phoenix Title" name="title">
<meta content="Override" property="og:title">

Installation

The package can be installed by adding :phoenix_meta_tags to your list of dependencies in mix.exs:

def deps do
  [
    {:phoenix_meta_tags, ">= 0.1.9"}
  ]
end

In your Web Module add this:

def view do
  quote do
    ...
    use PhoenixMetaTags.TagView # Add this
  end
end

def controller do
  quote do
    ...
    use PhoenixMetaTags.TagController # Add this
  end
end

Also put this render function inside your <head> tag of app.html.eex:

<head>
    <%= render_tags_all(assigns[:meta_tags] || %{})%> # Add this
</head>

Usage

Wherever you want to render meta tags, jut put it before render your view:

conn
|> put_meta_tags(%{
  title: "Phoenix Title",
  description: "Phoenix Descriptions",
  url: "https://phoenix.meta.tags",
  image: "https://phoenix.meta.tags/logo.png"
})
|>render("index.html")

Or, use it as a plug:

@meta %{
  title: "Phoenix Title",
  description: "Phoenix Descriptions",
  url: "https://phoenix.meta.tags",
  image: "https://phoenix.meta.tags/logo.png"
}

plug :put_meta_tags, @meta

Default value

You can put the default value for meta tags in your config file. This config will be merge with runtime tags before rendering.

config :phoenix_meta_tags,
  title: "Phoenix Title Default",
  description: "Phoenix Descriptions Default",
  url: "https://phoenix.meta.tags.default",
  image: "https://phoenix.meta.tags.default/logo.png",
  "og:text": "Hello Open Graph",
  fb: %{
    name: "facebook",
    size: %{
      width: 100,
      height: 200,
      position: %{
        x: 10,
        y: 15
      }
    }
  }

Copyright and License

Copyright (c) 2018 hlongvu

This work is free. You can redistribute it and/or modify it under the terms of the MIT License. See the LICENSE.md file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].