Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Congrats + a first question :) #4

Closed
marcfilleul opened this issue Oct 11, 2023 · 3 comments
Closed

Congrats + a first question :) #4

marcfilleul opened this issue Oct 11, 2023 · 3 comments

Comments

@marcfilleul
Copy link

Hi,

Congrats! I love this idea and will try Static asap.
From what I've seen, it could fulfill my needs.

The only extra thing I need is to fetch content from Airtable for example.
The output is in json format so it should be ok.
What would be the Static way of fetching json content and using it?

Finally, there is a little catch with "Airtable markdown flavor".
For now, I use a custom component to render Airtable markdown.
I use the "marked" package with this options:

marked.use({
  breaks: true,
  gfm: true,
});

What would be the Static way of doing this?

Thanks in advance.
I'm really excited by Static and would love to drop all these overkill frameworks!

Best regards.

@marcfilleul
Copy link
Author

I realize I should try to work on it before asking so let's pause this issue for now ;)

I'm going to try eleventy-fetch to fetch external json data and see if I can make it work.

Regarding the Airtable flavoured markdown coming from my json data, I will make some tests too.

@tnylea
Copy link
Contributor

tnylea commented Oct 11, 2023

Thanks @marcfilleul

Really appreciate it! I'm super pumped about this project. I was often looking for a Simple Static Site Generator, but hadn't really found one that made me happy or excited. That's why Static was born 😄

That Eleventy fetch package would probably work really well. Do you know the JSON format that is output from Airtable?

Here are a few ways we might do that

Using the Markdown as content

As long as the Markdown files get placed in the content folder it should be able to parse it. If it has frontmatter, you should be able to access it like normal.

On the otherhand if you wanted to loop through data such as a set of posts, you could add that as a collection.

Using the data in a collection

If you want to use that data as a collection, you could create it as a JSON file, such as posts.json in the collections folder. This could change down the road, but for now collections only work with a flat array of JSON data, like this:

[
    {
        "title": "Title Here",
        "description" : "description here..."
    },
    {
        "title": "Title 2 Here",
        "description" : "description 2 here..."
    },
    {
        "title": "Title 3 Here",
        "description" : "description 3 here..."
    }
]

Whereas this would not work:

[
    {
        "title": "Title Here",
        "description" : "description here...",
        "date" : {
            "month" : "Jan",
            "year" : "2018"
        }
    }
]

Unless you transformed that data 👆 into a flat array and then placed it to the collections folder.

I've also thought about the idea of adding a 'Plugin' system, where you could build additional functionality into Static by leveraging events throughout the build process. Let me know your thoughts 😁

Thanks as well for being the first issue submitter 👏

@marcfilleul
Copy link
Author

Thanks a lot for the detailed answer!
My json output from Airtable is not a flat array so it will spare me some time scratching my head 😅

I made some tests to see how far I could go compared to the Astro starter I've tailored for my clients.
There are too many limitations for my needs currently but I will follow this great journey!

I'll be happy to use Static for side projects and to help with feedbacks or ideas.

Keep up the good work 👏
Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants