Reputation: 831
I'm trying to use the alias plugin to do the following:
I have this source structure
/src/documents
gettingstarted.html
manual.html
What I would like in the output is this:
/out/
gettingstarted.html
manual.html
index.html -> redirects to gettingstarted.html OR just copies the content of gettingstarted.html
I've tried to accomplish this with the alias plugin as follows:
alias:
hard: true
symlink: true
aliases: {
'/index.html': '/gettingstarted.html'
}
extensions: [ 'html' ]
Unfortunately this doesn't seem to do anything. Does the alias plugin even support the static environment?
Upvotes: 0
Views: 61
Reputation: 13788
The plugin does support static mode as long as you are using the hard: true
option (which you are). Note, this will not redirect requests. Rather, it will create two URLs that have the same contents either by copying the source URL into the target URL or by creating a symlink at the target URL that points to the source URL.
I believe your problem is that you have the source/target mappings backwards. The documentation doesn't make it clear, but the config should follow this pattern:
alias:
aliases: {
'/source-file-that-exists.html': '/target-file-you-want-to-create.html'
}
So to copy gettingstarted.html
into index.html
you'd want:
alias:
hard: true
symlink: true
aliases: {
'/gettingstarted.html': '/index.html'
}
extensions: [ 'html' ]
Upvotes: 2