Dynamically generated html file

Q1. What’s the best way to PUT a dynamically generated HTM file (that remains) on the server for browsers & search engines to read?

Q2. Will it be picked up by search engines or is there some fundamental problem with ALL pages and search engines with an Anvil app?

Hi Paul, can you explain in more detail what you’re trying to do?

Like a CMS, my python code generates a HTM page that I want the world to view & search engines to index.

But how do I make it available . .

Does that page have to be within the Anvil app (ie is it “stand alone”, static content)? Because you could just FTP it to a regular apache webserver which would then behave as expected with google et al.

Just a thought.

1 Like

You don’t even need to run a webserver; you can use a cloud object store to serve static files. I would upload them to Amazon S3 using boto, the AWS Python API that’s available in the Anvil Server runtime.

If you’re using a custom domain, you can route a subdomain to your S3 bucket. For example, you might create an S3 Bucket called my-bucket-name, which AWS will serve on a URL such as my-bucket-name.s3-website.eu-central-1.amazonaws.com. You need to enable Website Hosting for that bucket for that URL to be available.

Assuming your custom domain is example.com, you can then create a CNAME from files.example.com to my-bucket-name.s3-website.eu-central-1.amazonaws.com, and all your files should appear under files.example.com.

So in this example, your app might upload myfile.html to your my-bucket-name bucket, and it would be available at files.example.com/myfile.html.

If you want to use a different cloud storage solution and its Python API isn’t available in the Anvil server runtime, just ask and we’ll install it for you (you can send me a private message if you don’t want to make public what solution you’re going with).

3 Likes

Alternatively, if you already have a web site that you can serve files from, you can embed your Anvil app within it, and serve your static files as you normally would.

I like that.

Will using CNAME affect how Google spiders/indexes/whatever it’s called these days?

No, I don’t think Google cares if it found your page via a CNAME or an A record. In fact, Google’s cloud storage docs recommend you take just the approach I suggested.

1 Like

How can I extract files for my personal website from the Anvil app?

Hi @adamhenry, can you explain what you’re trying to do in more detail? What files are you trying to extract?