Coder Social home page Coder Social logo

Comments (8)

farnabaz avatar farnabaz commented on June 9, 2024 1

Thank you for the report ❤️ . The fix release in v0.5.4

from amp-module.

mfrascati avatar mfrascati commented on June 9, 2024 1

@farnabaz I said hooray too fast, unfortunately it does not fix the issue.

It still fails here:

  switch (ampMode) {
    case true:
    case 'only':
      isAMP = true
      ampMode = 'only'
      if (options.amp && hasAMPPrefix) {
        return ctx.error({ statusCode: 404, message: 'This page could not be found' })
      }
      break

Setting mode to hybrid, with both routes handled as separate nuxt pages, is the workaround I found to skip this check for now.

from amp-module.

farnabaz avatar farnabaz commented on June 9, 2024 1

Thank you for sample ❤️
Your workaround is the correct way to create amp pages. You don't need to set amp: true in pages under /amp directory. All pages under /amp directory will mark as AMP.

Just to mention, This condition if (options.amp && hasAMPPrefix) {, should be here to prevent generating duplicate page on static generation.

from amp-module.

farnabaz avatar farnabaz commented on June 9, 2024

This seems an issue of routes generation.

from amp-module.

farnabaz avatar farnabaz commented on June 9, 2024

Oh I see, my bad.
I was misunderstand your problem (BTW, The outcome is good. I found another issue 😄)

Could you provide a simple reproduction on codesandbox?

from amp-module.

mfrascati avatar mfrascati commented on June 9, 2024

Sure, I managed to reproduce, breaking the nuxt-amp codesandbox working example 😅

https://codesandbox.io/s/nostalgic-grothendieck-vhf6n

Using the example /hello and /amp/hello routes.
Basically I set mode: false as default in nuxt config, then overridden with amp: true in /amp/hello and now it's broken

from amp-module.

mfrascati avatar mfrascati commented on June 9, 2024

Oh, I see! Maybe it could be worth mentioning it in the docs? amp: true could be misleading in this case

from amp-module.

farnabaz avatar farnabaz commented on June 9, 2024

Sure it does. Unfortunately I did not do well in documenting the module. I'll update the docs ASAP.

from amp-module.

Related Issues (20)

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.