How do I reset hugo's content listing cache? - hugo

I accidentally created content with the wrong path using hugo new content/my-page as opposed to hugo new my-page, and now the content (and its folder) keeps reappearing when I delete the content/content folder.
How do I get rid of this post for good? There doesn't appear to be a hugo delete command - so where is this information stored?

I assume you're using hugo serve to test your site?
If so, this is a side-effect of the hugo cache - in order to remain quick, deleted and renamed files will remain in the cache, and can thus be accessed. By restarting the server, the cache is cleared; which is why your problem fixed itself.
This isn't usually a problem, as you can rebuild the site at any time, and clear the cache when doing so.
I think you have a two options:
1 - ignore the files during development, knowing they will not exist in production
2 - restart the server after deleting or renaming files
Either way, knowledge of the problem is part of the solution.

Related

How to prevent deletion of old hashed build files and merge them instead

When building an adapter-static project inside build/_app/immutable there are some folders containing .css and .js files all with a hash like _page-65dc5ef0.css
Is there a way to prevent the deletion of these files and add the newly built ones instead?
I found the emptyOutDir flag, but setting it vite.config or svelte.config.js doesn't seem to have an effect.
There are two reasons I would like to keep the old files
older session recordings won't be displayed correctly if the corresponding .css file isn't available anymore
additional files are fetched when the user navigates on the site. As I understand these files might be deleted because of the new build and lead to errors. I assume this might be solved by watching the version number and do a full-page navigation after a change, but since the initial load of the page is quite big, this wouldn't go unnoticed for the user and I would like to avoid that.

Why is VSCode creating a history file?

VSCode keeps creating a history file even after I delete it. If I don't delete it, it accumulates to over 5000+ pending changes in my source control tab, and I don't know what I did with my settings for it to keep recreating the history folder. How can I delete this for good? I don't know if it affects my other files, and based on my history of deleting it, I don't think it does.
you can always add a .gitignore file and add the following line in it. This way your git engine won't pick them up.
.vscode
It just means you have a lot of vscode settings in your local, you can ignore them or delete them if you don't want to keep these editor settings. These settings won't affect any other files or other people's computer, as long as they don't get committed into the code repository.

How to reset solr back to first use?

I'm having a lot of problems running my solr server. When I have problems committing my csv files (its a 500 MB csv) it throws up some error and I am never able to fix it. Which is why I try to clean up entire indexing using
http://10.96.94.98:8983/solr/gettingstarted/update?stream.body=<delete><query>*:*</query></delete>&commit=true
But sometimes it just doesnt delete. In which casese, I use the
bin/solr stop -all
And then try, but again it gives me some errors for updating. Then I dedicided to extract the install tarball deleteing all my revious solr files. And successfully it works!
I was wondering if there is a shorter way to go about it. I'm sure the index files arn't the only that are generated. Is there any revert to fresh installion option?
If you are calling the update command against the right collection and you are doing commit, you should see the content deleted/reset. If that is not happening, I would check that the server/collection you are querying is actually the same one you are executing your delete command against (here gettingstarted). If that does not work, you may have found a bug. But it is unlikely.
If you really want to delete the collection, you can unload it in the Admin UI's Core page and then delete from the disk. To see where the collection is, look at the core's Overview page on the right hand side. You will see Instance variable with path to your core's directory. It could be for example: .../solr-6.1.0/example/techproducts/solr/techproducts So, deleting that directory after unloading the core will get rid of everything there.

Delta changes in GAE

I'm wondering, when I press "deploy" in the google app engine launcher, how does it sync my changes to the actual instance.... maybe it would be better to ask specific questions :)
1) Does it only upload the delta changes (as opposed to the entire file) for changed files?
2) Does it only upload new files and changed files (i.e. does not copy pre-existing) unchanged files?
3) Does it delete remote files that do not exist locally?
4) Does all of this happen instantaneously for the end user once the app has finished deploying? (i.e. let's say I accidentally uploaded an insecure file that sits on example.com/passwords.txt - if #3 is true, then once I remove it from the local directory and re-deploy it should be gone- but can I be sure it is really gone and not cached on some edge somewhere?)
If you use only the launcher or the appcfg util as opposed to manage your code by means of git, AppEngine will keep only one 'state' of that particular version of your app and will not store any past state. So,
1) Yes, it uploads only deltas, not full files.
2) Yes, only new, modified or deleted files.
3) Yes, it deletes them if you delete locally and deploy. As Ibrahim Arief suggested, it is a good idea to use appcfg so you can prove it to yourself.
4) Here there are some caveats. With your new deploy, your old instances are sent a kill signal, and until it actually gets executed, there is a time span (seconds to minutes) during wich new requests could hit your previous version.
It is also very important the point Port Pleco has made. You have to be careful with caching on static files. If you have a file with Expires or Cache-Control headers, and it is actually served, then it could be cached on various places so the existence of old copies of it, is completely out of your control.
Happy coding!
I'm not a google employee so I don't have guaranteed accurate answers, but I can speak a little about your questions from my experience:
1) From what I've seen, it does upload all files each time
2) See 1, I'm fairly sure everything is uploaded
3) I'm not entirely sure whether it "deletes" the files, but I'm 99% sure that they're inaccessible if they don't exist in your current version. If you want to ensure that a file is inaccessible, then you can deploy your project with a new version number, and switch your app version to the new version in your admin panel. That will force google to use all your most recent files in that new version.
4) From what I've seen, changes that are rendered/executed, like html hardcoded text or controller changes or similar, appear instantly. Static files might be cached, as normal with web development, which means that you might have old versions of files saved on user's machines. You can use a query string on the end of the file name with the version to force an update on that.
For example, if I had a javascript file that I knew I would want to redeploy regularly, I would reference it like this:
<script type="text/javascript src="../javascript/file.js?version=1.2" />
Then just increment the version number manually when I needed to force deployment of the javascript to my users.

How long does it take for updated static files to start being served?

I’ve just updated most of my static files but it seems that the old versions of those files are still being served. How long does it usually take for the new versions to be served? Is there any ways to speed that up?
Are you talking on production server?
In my project, usually they are affected immediately. Sometime due to the caching framework ,it keeps old static file served. I'm using Django-nonrel.
If you are using Google Chrome, you can you Inspect Element to see if it has an cache-control header or not.
Also this link will help you to change default_expiration on app engine.
Maybe it gives you some clues
I've found that it's usually immediate but sometimes takes about 15 minutes or so. For css/js many people append a build # to the filenames to break the cache.

Resources