How can I add a redirect to an article with Pelican? - pelican

I would like to have something in the header like
title: Whatever
slug: whatever
redirect: bla
redirect: foo
redirect: bar
so that Pelican generates pages which redirect from bla and foo and bar to whatever. Is this possible?

I just saw that this is called an "alias". There is the plugin pelican-alias which can be installed by pip install pelican-alias. Then pelican_alias has to be put into the PLUGINS list in pelicanconf.py. Aliases are then defined as
alias: bla, foo, bar

Related

Can I use a %variable% in module section of codeception environment file?

I tried to have the server address injected to the test with environment variable ABSOLUTE_URL so PhpBrowser would test against it. The config I wanted to do is something like this:
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: "%ABSOLUTE_URL%"
But I simply could not get it to work. Is there anyway I can do it?
Add params section to codeception.yaml file:
params:
- env
Documented at https://codeception.com/docs/06-ModulesAndHelpers#Dynamic-Configuration-With-Parameters

Is there a way to have posts at the root with Vuepress Blog plugin?

Using the Vuepress Blog plugin for a Vuepress blog website, is there a way to have posts at the root of the website?
E.g. I have foo.com with a post named post-1. I can show a PostIndex at foo.com/ but when I click on a post it goes to foo.com/posts/post-1. What I want is for a post to be at foo.com/post-1
I tried moving my posts out of the /posts folder into the project root and in the following config.js
plugins: [
[
'#vuepress/blog',
{
directories: [
{
id: 'post',
// dirname: 'posts',
dirname: '/',
path: '/',
// Avoid dates in URLs
itemPermalink: '/:regular'
}
]
}
]
]
I tried to change directories[0].dirname to /. This results in a "Page Not Found".
I know I can have post-1 at the root in Vuepress without the Blog plugin, but I'm trying to use the Blog plugin's pagination and other features.
If anyone else is having this issue, it seems to be that the directories[0].itemPermalink: '/:regular' makes the permalink not work. Changing to directories[0].itemPermalink: '/:slug' solves the issue.
Internally, Vuepress Blog plugin must be checking for the string "slug".

NuxtJS routing error: Page not found when navigating to an existing route

Just started using Nuxt, and I love it so far. I just have one specific issue, I'm using prismic.io as headless CMS for my personal page. I have a few pages and a "blog" page. I'm having an issue when navigating to the blog route, it returns page not found. Now, it's kind of odd because it's working perfectly in my local host, it's just behaving that way when deployed.
Site's being deployed on Netlify.
I already tried switching the route's links and building the project on my local machine and it's working like charm.
Link to site:
https://wonderful-gates-27a024.netlify.com/
This is my file structure for the pages:
Pages/
-- blog/
---- _uid.vue
-- About.vue
-- Blog.vue
-- Contact.vue
-- Works.vue
-- index.vue
Steps to replicate the issue
Navigate to about
Navigate to contact
Navigate to blog (Sometimes the error shows on this step)
Click on an article
Navigate back to the blog (here it should display not found)
Steps to navigate back to blog after the error shows up:
On the url bar, paste wonderful-gates-27a024.netlify.com/blog and hit enter.
I'm getting page not found error
It works sometimes because you are navigating to
https://wonderful-gates-27a024.netlify.com/blog/
Which is different from
https://wonderful-gates-27a024.netlify.com/blog
the page which is /blog
https://wonderful-gates-27a024.netlify.com/blog
doesn't exist while the page
https://wonderful-gates-27a024.netlify.com/blog/
exists. which is /blog/_uid
so if you want it to work make
Pages/
-- blog/
---- _uid.vue
---- index.vue// make this file and the /blog will work
-- About.vue
-- Blog.vue
-- Contact.vue
-- Works.vue
-- index.vue
We just had this error occur and it was caused by renaming About.vue to about.vue on a MacOS machine.
Git doesn't recognize it as a new file, so when you deploy the app on a Linux machine, the problem occurs.
The solution is to rename the file from a Linux machine, so that git recognizes it.
You could also probably accomplish it by renaming the file from Blog.vue to new-blog.vue and then renaming it again to blog.vue.
This is all caused by the fact that files aren't case sensitive on MacOS but they are on linux. You will see it where you have:
<NuxtLink :to="{ name: 'blog' }">
It must be blog.vue to match the route name because the filename leads to the route name. On Linux, the crawler will name the route "Blog" if it is Blog.vue.
You don't want uppercase filenames with nuxt, because they will lead to URLs such as /Blog. I don't recommend having uppercase in your pages directory.
We've now released the updated nuxt-prismic module to solve this dynamic routes issue and enable previews. You see how to migrate your project by following this article:
https://prismic.io/docs/vuejs/getting-started/the-new-prismic-nuxt-module
Also you can see a project enabled with the module already here:
https://user-guides.prismic.io/en/articles/2831943-nuxt-js-sample-multi-page-website-with-navigation

Add trailing slash to the every route path of the project in nuxt.js

There is a requirement of SEO optimization in nuxt.js project. It requires every route inside the project need add a trailing slash. How to solve the problem?
By the way, there is a question about it, but the accepted answer is not right for me. the question link is here:
Hi :) You need install #nuxtjs/redirect-module and add below rule to nuxt.config.js.
redirect: [
{
from: '^.*(?<!\/)$',
to: (from, req) => req.url + '/'
}
]
My answer is based on antonku's answer.
The answer from #kanapka94 is correct but incomplete. You need to add the module to your modules attribute in your nuxt configuration, e.g:
modules: [
'#nuxtjs/redirect-module',
]

Elixir Plug configure for specific file

I have defined a plug in my App.Endpoint module in the following way:
plug(
Plug.Static,
at: "/",
from: :main_web,
gzip: false,
only: ~w(css fonts images webfonts favicon.ico robots.txt sw.js manifest.json js/app.js),
headers: %{"Access-Control-Allow-Origin" => "*"}
)
Everything works as expected except that this plug is not applied for /js/app.js
I am currently not able to serve just /js/app.js, but instead am only able to specify js which will serve all the files in the /js directory.
How can I specify just this js/app.js file and not others?
I have tried
only: ~w(... app.js)
only_matching: ~w(... js/app.js)
But I always receive 404 for /js/app.js