https://twill.io logo
Join Discord
Powered by
# ❓questions
  • r

    Rayderxx

    05/18/2021, 7:31 PM
    ah ok
  • h

    hazelbag

    05/18/2021, 7:32 PM
    Thank you for the advice. If I have question I will be back. Appreciate the assistance
  • i

    ifox

    05/18/2021, 7:32 PM
    no it's actually to be able to preview content that isn't saved yet @User
  • r

    Rayderxx

    05/18/2021, 7:32 PM
    Yeah that's a good idea 😄
  • i

    ifox

    05/18/2021, 7:32 PM
    we put it in cache with the token, and then the API request can pull from it
  • i

    ifox

    05/18/2021, 7:33 PM
    Copy code
    public function previewData($item)
    {
        Cache::put($previewToken, $item, 60);
        return [
            'previewUrl' => $item->preview_url,
            'previewToken' => $previewToken,
        ];
    }
  • i

    ifox

    05/18/2021, 7:34 PM
    and in the API:
    Copy code
    $previewing = request()->has('previewToken');
    
    if ($previewing) {
        $item = Cache::pull(request('previewToken'));
    }
  • r

    Rayderxx

    05/18/2021, 7:37 PM
    Yeah in my case I have a api route that get draft && published item by slug
  • r

    Rayderxx

    05/18/2021, 7:38 PM
    and in the front a preview route with a ServerRednering
  • i

    ifox

    05/18/2021, 7:40 PM
    since you're using next, did you look into generating at build time? we do that too by listening Twill/model events to trigger a static rebuild. your site seems to be in SPA mode right now.
  • i

    ifox

    05/18/2021, 7:40 PM
    as in, it does API requests on the client side
  • i

    ifox

    05/18/2021, 7:42 PM
    oh no it seems like you're doing SSR, but there are still a couple of client side requests for things like the menu?
  • i

    ifox

    05/18/2021, 7:43 PM
    your SEO meta are rendered server side though, which is the most important bit I guess
  • r

    Rayderxx

    05/18/2021, 7:43 PM
    yeah we use StaticProps
  • r

    Rayderxx

    05/18/2021, 7:44 PM
    for the ssr
  • i

    ifox

    05/18/2021, 7:44 PM
    👍
  • i

    ifox

    05/18/2021, 7:44 PM
    but not staticPaths, right?
  • r

    Rayderxx

    05/18/2021, 7:44 PM
    both 😄
  • i

    ifox

    05/18/2021, 7:45 PM
    ok ok nice. that menu request is what confused me
  • r

    Rayderxx

    05/18/2021, 7:45 PM
    You can't use staticPath without StaticProps
  • i

    ifox

    05/18/2021, 7:46 PM
    correct, it would be getServerSideProps without
  • r

    Rayderxx

    05/18/2021, 7:46 PM
    yeah but no caching 😦
  • i

    ifox

    05/18/2021, 7:46 PM
    yeah
  • r

    Rayderxx

    05/18/2021, 7:47 PM
    and we use vercel for the front
  • i

    ifox

    05/18/2021, 7:47 PM
    nice
  • r

    Rayderxx

    05/18/2021, 7:48 PM
    https://vercel.com/docs/more/deploy-hooks
  • r

    Rayderxx

    05/18/2021, 7:49 PM
    and when a "module" is publish or updated an event is fire to the hook for rebuild the cache
  • d

    Dmi3yy

    05/19/2021, 10:56 AM
    Try install capsule
  • d

    Dmi3yy

    05/19/2021, 10:56 AM
    https://github.com/area17/twill-capsule-homepages#navigation
  • d

    Dmi3yy

    05/19/2021, 10:57 AM
    for route: 'route' => 'admin.homepages.landing', but where we set "landing" ?
1...567...484Latest