Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Sander Elias
    @SanderElias
    You can see ow to use jsdom in plugins in a couple of our own plugins. If you can't find one, ping me, and I will look.
    const extractState = (content: string): string | undefined => {
      if (!content.includes(SCULLY_STATE_START)) {
        return undefined;
      }
      try {
        return JSON.parse(content.split(SCULLY_STATE_START)[1].split(SCULLY_STATE_END)[0]);
      } catch {
        return undefined;
      }
    };
    Oshri Kdoshim
    @oshri
    @SanderElias Tnx, i will ping you when i have exemple to share & maybe i will do PR :)
    Sander Elias
    @SanderElias
    const replaceState = (
      html: string,
      newSate: { [key: string]: any }
    ): string | undefined => {
      if (!content.includes(SCULLY_STATE_START)) {
        return undefined;
      }
      try {
        const org = content.split(SCULLY_STATE_START)[1].split(SCULLY_STATE_END)[0];
        const newString = JSON.stringify(newState);
        return html.replace(org, newString);
      } catch {
        return html;
      }
    };
    is perhaps even easier ;)
    Paco
    @pacokleitz_gitlab
    @SanderElias not working with timeout 180.000 either, getting same error
    Fabrizio Fortunato
    @izifortune
    Hi all, I've started exploring scully and I was wondering how is possible to exclude a component from prerendering? Looking through the documentation the only reference that I can see its the following: https://scully.io/docs/Reference/plugins/community-plugins/regex/ is there something else that I could use?
    Sander Elias
    @SanderElias
    Yes, you can use isScullyRunning() in combination with for example an *ngIf=...
    in your App that is.
    Sander Elias
    @SanderElias
    @pacokleitz_gitlab The error means our background server isn't started, or the guess-parser is taking a really long time.
    There are a lot of people already working with Scully on gitlab, so I wonder why it doesn't work in your setup.
    we have our own setup working on github Actions.
    f you try to start the serve there (npx run scully serve) there might be a more helpful error available
    Fabrizio Fortunato
    @izifortune
    Thank you @SanderElias !
    Oshri Kdoshim
    @oshri
    @SanderElias Can i use resolver on blogs route that scully generate from md files ?
    Sander Elias
    @SanderElias
    I would not, but yes, it is technically possible.
    Usman Ali
    @muhammadosmanali
    Hi guys, i am using useHash true in app routing. when I build the app using scully, it generates the same index.html for every route. how to solve it
    Sander Elias
    @SanderElias
    @muhammadosmanali Use a web server that can serve files with an '#' in the pathname.
    spoiler: none can do that. Hash routing is incompatible with SSG
    Wheater
    @Wheater
    Hi there, I'm wondering if there is a simple way to load front matter from a markdown file into a route without the :slug parameter in the blog example.
    For instance, I'd like to load information for my about page from a markdown file. How can I do this without the :slug parameter?
    Wheater
    @Wheater
    To add to this, my goal would be to have a folder that contains different markdown files, each markdown file containing front-matter used for displaying data on the page. I would like to pull all markdown files using scully.available$ on a route without a slug. So if I have a /features route, I want to dynamically display however many features are listed in the /features content folder all on the same page, but I don't individual routes for them using the blog example of /features/:slug.
    Sander Elias
    @SanderElias
    The slug parameter is a relevant parameter to how the page is rendered, but it doesn't get any other treatment as any of the other front-matter yaml info.
    All the info that is in the front-matter will be in the Scully route service, with or without slug
    Wheater
    @Wheater
    I am getting this when trying to use a /features route without :slug in the scully.<app>.config.ts file:
    ⠼ content files added 2missing config for parameters (undefined) in route: /features. Skipping
    Here is the config file:
    '/blog/:slug': {
          type: 'contentFolder',
          slug: {
            folder: "./libs/shared/blog/blog"
          }
        }, 
        '/features': {
          type: 'contentFolder',
          slug: {
            folder: "./libs/shared/product-feature/features"
          }
        }
    Sander Elias
    @SanderElias
    If you don't want to render a page for each of your markdown files, you can use the preRender config property to bail out of the actual rendering.
    Wheater
    @Wheater
    Interesting. I'm very new to scully, would you be able to point me to that doc for that config? Is it part of the scully.<app>.config file?
    Sander Elias
    @SanderElias
        '/features': {
          type: 'contentFolder',
          preRender: async () => false,
          slug: {
            folder: "./libs/shared/product-feature/features"
          }
        }
    Wheater
    @Wheater
    okay, cool. I'll try that. Thanks!
    Sander Elias
    @SanderElias
    It will put all the routes in, but none of the index.html's
    the function receives the handledRoute as a param, you you can even go as gradual as you like.
    Oh, you need the /:slug still in there tho!
    Wheater
    @Wheater
    I'm still getting the missing config message above
    ah, gotchha
    that worked perfectly, thanks!
    What would the strategy be for loading a single markdown file? For example, if I have an /about page that has front-matter that I need access to, should I do the same thing?.
    Ondrej Polesny
    @ondrabus
    Hi guys, I have been playing around with Scully for the past few weeks and I managed to get the whole website generated into static files. Everything works fine when I serve it using any HTTP server and disable JS in the browser. However, when I keep JS enabled, the website behaves like a normal SPA, does standard API requests on the fly, and so on. Is this intentional or am I missing something? Other SSGs use JS to enable instant content changes, nice transitions, etc. But the core functionality is still pre-generated. So I want to have that possibility with Scully too, but maybe this is not possible?
    Wheater
    @Wheater
    Hi there, I am interested in using this feature. Did this PR get completed? scullyio/scully#829
    Wheater
    @Wheater
    The issue I have is that following the referenced plugin to use a single markdown file for a route, I cannot get the front-matter to pull into the Scully route service. The route for the individual page always ends up with a single property, route.
    Sander Elias
    @SanderElias
    I did write the plugin. Israel was supposed to finish it up and get it merged. I'll check.
    Sander Elias
    @SanderElias
    @ondrabus Yes, the spa boots by design. If you want you can strip that using a plugin. You can opt-in to save all data coming from API's into the static files by using transferState.
    Wheater
    @Wheater
    @SanderElias I used the plugin example tjat you showed. My issue is that front matter was unavailable for the single page route. The scully content was there, but no front matter. Do you know how I can resolve that?
    Sander Elias
    @SanderElias
    The frontmatter is available in the scully route service.
    Wheater
    @Wheater
    Hi @SanderElias, sorry to bug you again. However, this plugin is not performing as I would expect. I am attempting to use the plugin you built for #829 (mentioned above), and I am only seeing the scully-content, not any front-matter available in the scully route. Can you please let me know if I am doing something wrong?
    registerPlugin('router', 'singleFilePlugin', async (route, config) => {
      return [
        {
          route,
          templateFile: join(scullyConfig.homeFolder, config.file),
          postRenderers: ['contentFolder'],
        },
      ];
    });
    
    export const config: ScullyConfig = {
      projectRoot: "./apps/wsg-ext/src",
      projectName: "wsg-ext",
      outDir: './dist/wsg-ext',
      defaultPostRenderers: postRenderers,
      routes: {
        '/': {
          type: 'singleFilePlugin',
          file: './libs/shared/wsg-external-home/content/content.md'
        }
      }
    };
    export class SomeComponent {
    
      content$ = this.scully.available$.pipe(
        tap(console.log),
        map(routes => routes.find(r => r.route === '/'))
      );
    
      constructor(private scully: ScullyRoutesService) { }
    }
    When I check the console to see the available routes, the route "/" has no front matter.
    Wheater
    @Wheater
    If this is a worthy scenario of creating a bug, let me know and I will create one in the github repo.
    Sander Elias
    @SanderElias
    If you have an repo with a sample of what you ill do I will have a look. Make a md file with what it is you need. (I talk to a lot of people, and am easily confused ;) )
    I will update it so it does what you need., or (if needed) create the PR that adds the eventually missing piece
    Justin Greet
    @justingreet

    Hi. Scully has been a god-send for SEO performance so far, but we're about to launch with it and I'm running into a key issue I can't seem to overcome in a clean way. We have a blog portion of our site where Scully works as expected.

    We have an app portion of the site that we want Scully to ignore. So we use the "ignored" plugin for those routes. However, because it's ignored and doesn't appear in dist/static, you get a 404 when you try to access one of those routes directly. Is there a way to instruct Scully to ignore certain routes, and display a static page with fixed content while Angular is loading, then fallback to Angular routing when it's ready?

    This is likely just a logical misunderstanding on my part. Thanks for the help!

    Sander Elias
    @SanderElias
    @justingreet set up a 404 handling on your server that takes care of this. Depending on the number of pages you want to stubb, you might do what you are asking for by using isScullyRunning() in your app, and set up the spinner thing in there.