[go: nahoru, domu]

Tricks

Simple site-search for Hugo, using Google

Want a simple search functionality for your Hugo site? Here’s the setup I used here. It uses the Google search advanced query operators (which you can get if you go to Tools / Advanced Search) to add the site as a separate parameter. as_q = the query you want as_sitesearch = the site you want to search in It opens up in a separate window, if you’re ok with that. Otherwise, just remove the target="_blank" part.

Converting WordPress and Plog to markdown

Converting HTML to markdown for Hugo isn’t super-complicated, it’s just a bit annoying if you have to do it for a bunch of individual posts. There are a few options documented. (Image to see if SVGs work here. I guess they do.) Wordpress I didn’t want to install new plugins on my aging WordPress installations, so I went for the Python setup ExitWP-for-Hugo. It takes the exported XML file from WordPress and churns out a bunch of .

Using nofollow links in Hugo's Markdown

I seem to have more posts about nofollow links than actual nofollow links, but here’s one more. Markdown doesn’t support nofollow links by default, so you either have to write them in HTML or tweak your template to handle them. Update: after reviewing the options, I ended up using a bounce-URL instead. Nofollow links with HTML This is kinda simple. Just write HTML directly in markdown: anchor <a href="https://example.com" rel="nofollow">anchor</a> Nofollow links with markdown There are probably easier ways to do this, but I didn’t spot any off-hand.

Confirm that you're using Analytics on all pages

Here’s something from my mailbox - someone wanted to know how he could crawl his site and confirm that all of his pages really have the Google Analytics (archive.org) tracking-code on them. WordPress users have it easy, there are plugins that handle it automatically. Sometimes it’s worth asking nicely :) - let me show you how I did it. As a bonus, I’ll also show how you can check the AdSense ID on your pages, if you’re worried that you copy/pasted it incorrectly.

Running Firefox in parallel

Sometimes it would just be great to have multiple instances of Firefox running at the same time. Some web applications just love to eat memory in Firefox, some web pages go crazy if you have JavaScript enabled and sometimes you just want different sets of cookies to let you manage two accounts at the same time. I’ve been trying to do that for years and did the most exotic things to make it happen.

Go hack yourself - recovering your FTP password

All of the websites I put together at the moment are used for playing around and testing things. It’s fun to set up a site, try some things out, delete it or just let it sit and then - usually much later - start over and try something else. The only problem is that by the time I am ready to start over, I have forgotten my password. I can find my user name, it’s in the FTP client and visible in my hosting control panel, but the password is not visible anywhere.

How to use Google webmaster tools stats with Excel

Google’s webmaster tools (archive.org) has a neat feature that lets you download your query and click statistics (once you have verified ownership of your site). The data you can get from there is quite comprehensive, but hard to break down for use in Excel. As a fun exercise I put together a small Python-script that takes the CSV file downloaded from your webmaster tools account and turns it into new CSV files for queries and for clicks (both with the position numbers as well).

A set of command-line Windows website tools

If you have to do things over and over again, it’s a good idea to use a tool to make things easier. Windows is a bit limited (or very - when compared to Linux) when it comes to batch file scripts and “wget” is limited to what it can do right out the box, so I sat down and wrote a few command line tools to help me with some of the website checks that I like to do.

Check your web pages for hacks and unauthorized changes

Websites have become popular targets for hackers, who either try to add elements that automatically download “malware” (viruses, etc) or try to add hidden links (SEO hacking) to other websites. Quite often, these kinds of changes are not recognized by the webmaster or website owner. You could wait until a visitor complains to you or you receive a mail from Google for spreading malware (or having hidden links to “bad places”), but that is slow, unreliable and usually too late.