I’m pretty sure there’s no support for this right now, but is there a way to customize the page that gets produced by aliases? I want to be able to add custom headers to the alias page, so that I can support Go vanity urls without needing to manually create a page for every subdirectory.
What I’d like, and what I think it possible, is something like this:
aliases = ["/foo/bar", “/foo/baz”]
aliasHeaders = [ ‘’]
The alias headers would get added to the header that is put on the redirect page. This should be pretty easy, and I’m certainly willing to code it myself if that’s acceptable.
Ideally, what I’d like is a way to say “any requests for any page under this directory, redirect to this page” … but I’m not sure that’s possible with a static site on most hosts.
No, the alias template(s) are hardcoded.
A PR is welcomed … but you fail to enlighten me about the connection between alias/redirects and Go vanity URLs. Is this a Google meta keyword? And does that keyword have a name? (I tried to Google it).
@bep by “Vanity URL,” I think he just means a shorter URL you can include in things like marketing materials, etc. Kind of like having your own bitly. In a way, this is what the aliases already do, but they can’t be set up in groups.
301s are still the best option for SEO, however, so I think you’re better off setting up something ok your server, @natefinch. If you are not terribly worried about SEOt, why not just set up a permalink in your config for whatever the new URL should be for a section and then write some client-side JS to redirect to the appropriate page by pulling from the existing URL.
Sorry, vanity import paths for the Go programming language: ala this stuff: https://golang.org/doc/go1.4#canonicalimports
I just need to insert a meta element like this in the header of the redirect page that hugo creates:
<meta name="go-import" content="npf.io/gorram git https://github.com/natefinch/gorram">
I think what might work well is to be able to make a template specifically for the redirect page (like there is for the 404 page), and then pass the metadata from the page that’s being aliased to the redirect template… that way the redirect template can easily be customized for the page it’s redirecting for.
Yes, that would be good – then I don’t have to really understand the “vanity stuff”.
BTW, gorram is a really cool project.