Code Monkey home page Code Monkey logo

remix-seo-v2's Introduction

Forked from chaance/remix-seo

If you wish to use this, add this to your package.json


"remix-seo-v2": "github:EuSouVoce/remix-seo-v2",



remix-seo-v2

A package for easily managing SEO metadata tags in Remix.

WIP!

This fork is being mainteined by EuSouVoce, it has some differences from the original one. Chaance takes too long to update his package... That's why i've made this fork.

Usage

// app/seo.ts
import { initSeo } from "remix-seo";
export const { getSeo, getSeoMeta, getSeoMetaV2, getSeoLinks } = initSeo({
 // Pass any SEO defaults for your site here.
 // If individual routes do not provide their own meta and link tags,
 // the tags generated by the defaults will be used.
 title: "The Awesome Store",
 titleTemplate: "%s | The Awesome Store",
 description: "The most awesome store on planet Earth.",
});

// ------------------------------------------------------------

// app/root.tsx
import { getSeo } from "~/seo";
let [seoMeta, seoMetaV2, seoLinks] = getSeo();

// ------------- v1 ------------
export let meta = () => ( ...seoMeta, { whatever: "cool" } );

// ------------- v2 ------------
export let meta = () => ( [...seoMetaV2, { whatever: "cool" }] );

// Links
export let links = () => [ ...seoLinks, { rel: "stylesheet", href: "/sick-styles.css" } ];

// ------------------------------------------------------------

// app/routes/some-route.tsx
import { getSeo, getSeoMeta, getSeoLinks } from "~/seo";

// No need for route data? Get meta and links in one call.
let [seoMeta, seoMetaV2, seoLinks] = getSeo({
 title: "About us",
 description: "We are great!",
});


// -----------  v1 Meta ----------------
// SEO depends on route data?
// call getSeoMeta and getSeoLinks individually in the relevant function.
export let meta = ({ context }) => {
 let seoMeta = getSeoMeta({
  title: `Welcome ${context.name}`
 });
 return {
  ...seoMeta,
 };
};

// -----------  v2 Meta ----------------
// SEO depends on route data?
export let meta = ({ context }) => {
 let seoMetaV2 = getSeoMetaV2({
  title: `Welcome ${context.name}`
 });
 return seoMetaV2; // or [...seoMetaV2] both will work.
};
export let links = ({ context }) => {
 let seoLinks = getSeoLinks({
  title: `Welcome ${context.name}`
 });
 return [...seoLinks];
};

remix-seo-v2's People

Contributors

chaance avatar eusouvoce avatar danestves avatar cliffordfajardo avatar mcansh avatar smerchek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.