Live data from Hacker News

Ask HN: Best way to create a landing page?

news.ycombinator.com

11–20 of 65 posts

Re: Ask HN: Best way to create a landing page?

#14
post #4

In a somewhat similar situation I used PHP with `include`. The structure was something like this: - index.php - header.php - sidebar.php - footer.php - page-1.php - page-2.php ... In `header.php` I used variables for the title, description, etc. and then in each page I specified the values for those variables. This way each page had the same header HTML code, but with a different title, description and so on.

I do my PHP in completely different way, which in turn was the way I did ASP back in the day, also in a weird way.

All my HTML is held in template .html files, with %%PLACEHOLDER%% text where the dynamic content should be, Then my index.php is the main 'app' loading in the templates to build the output, doing string replaces on the html, and then a single final 'echo' to send the result to the user at the end of the process.

I think this is called 'code behind' - I've just always had a problem with mixing code and layout in the same file.

Does anyone else do it like this?

Re: Ask HN: Best way to create a landing page?

#15
An option that I like to use is Middleman (or any other static site generator) for creating the pages and Netlify for hosting, all for free even with your own domain and HTTPS.

You have nice static HTML pages with a CDN, super fast, and there's even a CMS option with NetlifyCMS, which works by creating git commits for you and then automatically pushes the new static version on Netlify. The basics in Netlify are free and there are nice add-ons where some are also free (e.g. forms).

Check out the template list here: https://templates.netlify.com

Re: Ask HN: Best way to create a landing page?

#17
post #14
post #4

In a somewhat similar situation I used PHP with `include`. The structure was something like this: - index.php - header.php - sidebar.php - footer.php - page-1.php - page-2.php ... In `header.php` I used variables for the title, description, etc. and then in each page I specified the values for those variables. This way each page had the same header HTML code, but with a different title, description and so on.

I do my PHP in completely different way, which in turn was the way I did ASP back in the day, also in a weird way. All my HTML is held in template .html files, with %%PLACEHOLDER%% text where the dynamic content should be, Then my index.php is the main 'app' loading in the templates to build the output, doing string replaces on the html, and then a single final 'echo' to send the result to the user at the end of the…

Yes, I've done it that way before. Actually just did a few weeks ago when building a frontend for a WordPress site. The frontend consumes the API and takes care of lightning-fast delivery by cutting out all the normal WordPress stuff that normally runs, when building a theme.

Re: Ask HN: Best way to create a landing page?

#18
> Is wordpress still a good alternative?

No, you just said you don't need a CMS.

I would hand edit the HTML and deploy it on Netlify with a Parcel build step, at least that's what I've done.

https://parceljs.org/

    parcel build *.html --public-url https://your.page
> I want it to be SEO optimized.

It's a complex problem, it all boils down the template you use. I usually hunt hours for free HTML/CSS templates then get mad about them and create one from scratch using some CSS framework :)

Post reply on HN