Coder Social home page Coder Social logo

Comments (3)

michalczaplinski avatar michalczaplinski commented on August 11, 2024 2

Based on our in-person conversation with @mburridge here are some more details about Frontity Options and their use case. I think that it can be useful to think about the Frontity Options as this:

Dynamic configuration that can be specified via query string but which does not form part of the canonical link

The important part here being the does not form part of the canonical link. That means that whatever is passed in the frontity_*** query is not going to be used to be matched by handlers or used to fetch data from WordPress. Its purpose is to allow dynamic configuration of Frontity like the configuration that Luis has specified above:

  • Some of these "Frontity Query Options" will be used by the core, like for example:

    • frontity_name -> state.frontity.options.name: The name of the site you want to load.
    • frontity_public_path -> state.frontity.options.publicPath: The public path that you want to use (not ready yet, but it will exist).
  • But packages can also make use of them, like for example:

    • frontity_source_auth -> state.frontity.options.sourceAuth: A authentication token for the source package.
    • frontity_comments_skip -> state.frontity.options.commentsSkip: A boolean to skip rendering the comments (it's not real, I've just made it up).

from api-reference.

luisherranz avatar luisherranz commented on August 11, 2024 1

Great summary Michal 🙂

I'd like to add that we are looking for a name for the query parameters that start with frontity_. It's a new concept in Frontity, so I think it deserves its own name. We've used Frontity Query Options and I think it is good so we can stick to that.

The "Frontity Query Options" could have their own section in the docs. They work as described by Michal:

  • Any query param in the URL that starts with frontity_ is a "Frontity Query Option".
  • Those queries are reserved to "send special information to Frontity", not related to the URL that needs to be rendered (a post, a page, or whatever), but to the Frontity configuration.
  • Those parameters are removed from the state.frontity.initialLink and state.router.link because they should not affect the content of what needs to be rendered (a post, a page, or whatever).
  • Those parameters are added to state.frontity.options. Packages that use them will look for them there.
  • The name of those parameters is converted to camelcase. The value is not transformed.
  • Some of these "Frontity Query Options" will be used by the core, like for example:
    • frontity_name -> state.frontity.options.name: The name of the site you want to load.
    • frontity_public_path -> state.frontity.options.publicPath: The public path that you want to use (not ready yet, but it will exist).
  • But packages can also make use of them, like for example:
    • frontity_source_auth -> state.frontity.options.sourceAuth: A authentication token for the source package.
    • frontity_comments_skip -> state.frontity.options.commentsSkip: A boolean to skip rendering the comments (it's not real, I've just made it up).

from api-reference.

mburridge avatar mburridge commented on August 11, 2024

Closed by #24 and frontity/docs#281

from api-reference.

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.