Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 10 2019 10:49

    pi0 on master

    chore: update readme.md (compare)

  • Feb 10 2019 10:48
    manniL commented #319
  • Feb 10 2019 10:47

    pi0 on master

    chore: update build badge (compare)

  • Feb 10 2019 10:44

    pi0 on master

    chore: remove travis and packag… chore: enable renovate chore: add yarn.lock and 1 more (compare)

  • Feb 10 2019 10:34
    alexchopin removed as member
  • Feb 10 2019 10:34
    Atinux removed as member
  • Feb 10 2019 10:34
    manniL removed as member
  • Feb 10 2019 09:12
    pimlie commented #319
  • Feb 10 2019 09:11
    pimlie synchronize #319
  • Feb 10 2019 09:08
    pimlie commented #319
  • Feb 10 2019 09:06
    pimlie synchronize #319
  • Feb 10 2019 08:55
    pimlie synchronize #319
  • Feb 10 2019 08:04
    pimlie synchronize #319
  • Feb 09 2019 22:27
    manniL commented #319
  • Feb 09 2019 21:39
    pi0 review_requested #319
  • Feb 09 2019 21:39
    pi0 review_requested #319
  • Feb 09 2019 21:12
    pimlie opened #319
  • Feb 08 2019 10:15
    manniL commented #318
  • Feb 07 2019 17:45
    yekver commented #318
  • Feb 07 2019 17:45
    yekver commented #318
Sébastien Chopin
@Atinux
Hi there!
Declan de Wet
@declandewet
Hi @Atinux!
Tristan
@Sleashe
Hi @Atinux ! I got a question for you using your vue-meta module and server-side redenring
Sébastien Chopin
@Atinux
Sure @Sleashe
Tristan
@Sleashe
Crap, I'm late, I didn't see ur message
Anyway, here's my issue

I started my project from the well known official hackernews2 template. I precisely followed vue-meta plugin instructions regarding SSR but when I log context.meta.inject().title.text() when rendering on server, I always get:
<title data-vue-meta="true"></title>

Since the code from hackernews was a bit different, here's what I did :

Added Vue.use(Meta) inside app.js
Added const meta = app.$meta() and context.meta = meta inside server-entry.js
Added some metaInfo inside app.vue component
Updated the code inside server.js to this (I don't know if its the best way):

let context = { url: req.url }
  let stream = renderer.renderToStream(context)
  stream.on('error', errorHandler)
  stream.on('end', () => console.log(`whole request: ${Date.now() - s}ms`))
  stream.on('pipe', (chunk) => {
    const {
      title, htmlAttrs, bodyAttrs, link, style, script, noscript, meta
    } = context.meta.inject()
    console.log(title.text()) /* Here's where I always got <title data-vue-meta="true"></title> */
    chunk.head = chunk.head.replace(/<title>(.*?)<\/title>/, title.text()) //Obviously, regarding the previous line, the replaced title contains <title data-vue-meta="true"></title>...
    chunk.head = chunk.head += meta.text() // A test to append meta from vue-meta at the end of the header. Didn't try it yet
  })
  stream.pipe(res)
Sébastien Chopin
@Atinux
Do you have a repository where I can try your upates @Sleashe ?
Mark Heppner
@mheppner
I couldn't find any issues on this, but I think webpack is messing up for me. In my server-entry.js, I have const meta = app.$meta(), but when the server starts, there's a traceback with TypeError: r.a.$meta is not a function.
Also whats the difference between import VueMeta and import Meta?
Mark Heppner
@mheppner
I'm using this template for vue-cli.
Andrew
@sokyrko
@mheppner are you fixed this? I have same issue
Mark Heppner
@mheppner
@sokyrko no, but I switched to nuxt.js, which has it bundled and everything works as expected. I guess I just didn’t set it up correctly, but I’m not sure what the issue was.
Andrew
@sokyrko
@mheppner ok, thanks, i'll try to fix... Or I just will switch to nuxt.js too :smiley:
Mark Heppner
@mheppner
@sokyrko honestly, I found it much easier. If you’re doing SSR stuff, nuxt is extremely helpful, and doesn’t really get in your way. It might be a bit of work switching your codebase over, but I think it’s worth it.
Andrew
@sokyrko
@mheppner fixed!
const createRenderer = bundle => {
  return vueRenderer.createBundleRenderer(bundle, {
    runInNewContext: false, // just add this line and vue meta will work
    cache: lru({
      max: 1000,
      maxAge: 1000 * 60 * 15
    })
  })
}
Mark Heppner
@mheppner
interesting, I don’t remember seeing that anywhere
Andrew
@sokyrko
there are api docs about runInNewContext param too
Mark Heppner
@mheppner
Hm yeah, I don’t remember seeing that when I tried to get it working. Good find!
Nicklas Nilsson
@nilsi
Hello, I have a problem where my title becomes undefined for my titleTemplate on initial page load or page refresh
While Im navigating within the page it updates fine, its just when refreshing the title becomes undefined. Any idea what could cause this?
Nicklas Nilsson
@nilsi
Oh I found the reason, I had a template that defined a metaInfo tag without content. That template was a search overlay that overrides all other metaInfos and was available on all pages.
Ranie Santos
@raniesantos

Help

If subcomponents specify a metaInfo.title I want this PageTitle | SiteName
If subcomponents DON'T specify a metaInfo.title I just want this SiteName

I need the pipe | to be appended conditionally based on the title but I don't see a way to check the value of title before titleTemplate is parsed