veliovgroup / Meteor-flow-router-meta

Reactive meta tags, JavaScript links and CSS for meteor within flow-router-extra
https://packosphere.com/ostrio/flow-router-meta
BSD 3-Clause "New" or "Revised" License
37 stars 3 forks source link

META tags are created AFTER template creation on the client side #16

Closed carlosalvidrez closed 1 week ago

carlosalvidrez commented 1 week ago

Is there any way to have the "meta" tags be applied BEFORE the corresponding template is created? I realize I might be missing something.

Check this out:

// This does run BEFORE the template CREATED event
title(params, query, data = {}) {
    return `${data.field_x}`;
},

// This runs AFTER the template is CREATED and RENDERED, causing the meta tags to be applied on the client, at run-time, therefore being missed by search engines
meta: {
    "twitter:title": {
        content(params, query, data = {}) {                
            return `${data.field_x}`;
        }
    },
}
dr-dimitru commented 1 week ago

@carlosalvidrez both title and meta executed and added to the DOM during runtime. To make sure it's available to Search engines you have various options:

  1. prerendering.com / ostr.io
  2. Static template generator there's various ones for Blaze/React/Vue, what's your front end though?
  3. SSR
carlosalvidrez commented 1 week ago

Thanks @dr-dimitru ...

  1. Trying to avoid having to pre-render, but I hear you.
  2. Curious about "static template generator"; I use Blaze... could you share some sort of link to it?
  3. Any sort of link on how to do SSR perhaps only for bots?

Cheers

dr-dimitru commented 1 week ago

@carlosalvidrez

  1. If you doing this for SEO (not for link previews), only way to avoid "cloaking" is to use pre-rendering (or invest a lot into SSR)
  2. static-html with combination of custom middleware handler to modify default's Meteor's response to initial HTML
  3. Blaze's SSR — https://github.com/meteorhacks/meteor-ssr (there's up-to-date fork by @harryadel (perhaps he can drop couple of notes reharding this question as well here)
carlosalvidrez commented 1 week ago

Thank you!