Git Product home page Git Product logo

Comments (15)

ctrl-b avatar ctrl-b commented on June 7, 2024 2

I have a workaround for this feature, I'm sending the values using options[name] hidden fields, everything is preformatted on the client's side with JS, date and dashed file name, my staticman config file looks like this:

filename: "{options.submitdate}-{options.dashedtitle}"

Additionally it would be great that commitMessage: accepts placeholders too, if so we can include a title or something more related to what was submitted/sent.

from staticman.

eduardoboucas avatar eduardoboucas commented on June 7, 2024 2

@Twentytwoo Well, it took a while to land this feature, so thanks for your patience and for your help with testing. I've deployed the feature to the live API. Will close the issue as soon as I add this to the documentation.

from staticman.

simonv3 avatar simonv3 commented on June 7, 2024 1

@usrix I opened a separate issue for the commitMessage thing here #79

from staticman.

danPixl avatar danPixl commented on June 7, 2024

I'd be incredibly interested in something like this. I'm working on a news site that users can post on for my neighborhood. It would be great if people could share links to individual articles.

from staticman.

simonv3 avatar simonv3 commented on June 7, 2024

We want this for @opensourcedesign as well. How would we go about adding this feature to staticman?

from staticman.

eduardoboucas avatar eduardoboucas commented on June 7, 2024

I think we could add a special placeholder that formats a date with Moment.js (we're using it already). This should give people enough flexibility to format the path according to their requirements.

Placeholders are resolved here, so I think this should go somewhere in there.

I will try to look into this in the next couple of days, but if anyone wants to have a go at it I'm happy to assist!

from staticman.

taxilly avatar taxilly commented on June 7, 2024

Any update on being able to set the file to a .html instead of .md, @eduardoboucas ?

from staticman.

eduardoboucas avatar eduardoboucas commented on June 7, 2024

@Twentytwoo I've added this to the preview instance. Can you help test it? Here's how:

  1. In your site config, add an extension property with the extension you want to use (e.g. "html")
  2. Temporarily post your forms to dev.staticman.net instead of api.staticman.net

Thanks!

from staticman.

taxilly avatar taxilly commented on June 7, 2024

https://github.com/twentytwoo/startpages.cf/pull/42

That works great :) Thanks @eduardoboucas

from staticman.

eduardoboucas avatar eduardoboucas commented on June 7, 2024

Done, it's now available on the live API. So all we're missing from this issue now is the ability to manipulate the filename to include that date format, right?

from staticman.

taxilly avatar taxilly commented on June 7, 2024

Thanks a lot - That's right, I'm looking forward to it 👍

from staticman.

eduardoboucas avatar eduardoboucas commented on June 7, 2024

Okay, @Twentytwoo here's another one for you to test. 😄

I've added a special placeholder that renders the current date in any format supported by Moment.js. Here's how to test this:

  1. Change your URL to dev.staticman.net instead of api.staticman.net
  2. Change your config to: filename: "{@date:YYYY-MM-DD}-{fields.title}"

Let me know how you get on. Thanks!

from staticman.

taxilly avatar taxilly commented on June 7, 2024

Looks like it's working well, https://github.com/twentytwoo/startpages.cf/pull/43 - Thanks again for all your hard work.

from staticman.

ctrl-b avatar ctrl-b commented on June 7, 2024

@eduardoboucas is it possible to configure the timezone? and re-format the fields.title? i.e. to lowercase and change spaces for a dash

thanks

from staticman.

eduardoboucas avatar eduardoboucas commented on June 7, 2024

Finally documented placeholders: https://staticman.net/docs/placeholders

@usrix could you open a separate issue for that, please?

Thanks all!

from staticman.

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.