I have created sails js appication. Now I want to create seo friendly url for my application. Is there any plugins for sails js to create seo friendly url or should I create them manually?
In Sails.js, you can set up your routes to something like (assuming you're setting up a blog app)
'get /articles/:title': {
controller: ArticlesController
}
And inside ArticlesController, you can have a function that creates url slugs from the blog post title (something like SpeakingURL). You then save this in your models/Articles.js in a post-title field. Now, everytime someone wants to visit example.com/articles/how-to-get-cats-to-like-you, it will automatically fetch the relevant article.
Related
By default, nuxt adds a route for each page in pages.
I want to make when going to the page e.g. project.local/id/ec29cjsa5fas512ik, the user goes to a page template and the Vue receives this ec29cjsa5fas512ik id from the url so it can make proper API calls later.
You can make a dynamic page in Nuxt2 with the following file, eg.
/pages/details/_id.vue
then you'll have a path like /details/:id.
More info can be found here: https://nuxtjs.org/docs/features/file-system-routing#dynamic-routes
I want domain.com/custompage, but the built in functionality puts all pages inside a /pages/ directory so the URL comes out domain.com/pages/custompage which I don't want.
I found this answer from a Shopify Guru in 2016 that mentions potentially setting up a custom HTML template or using an app, which no longer exists.
Any clues on how to achieve this? I have limited experience with Shopify templates, but could figure it out if someone could point me in the right direction.
This blogger says it can't be done:
"Q: Can you create pages on the root? A: The answer to this is no –> all pages have either /pages/, /collections/ or /products/ in the URL."
However others have told me it is possible. Just not how to do it.
Create a section Name "test" // first a step
Create a page json Name "test" // The second step
After creating the page, JSON does a section test
I'm new to razor pages (used to MVC pattern). I came across some interesting routing pattern I saw on GitHub:
services.AddMvc()
.AddViewLocalization()
.AddDataAnnotationsLocalization()
.AddRazorPagesOptions(options =>
{
options.Conventions.AddPageRoute("/Edit", "/{Slug}/Edit");
options.Conventions.AddPageRoute("/Delete", "{Slug}/Delete");
options.Conventions.AddPageRoute("/Details", "{Slug?}");
options.Conventions.AddPageRoute("/Details", #"Index");
options.Conventions.AddPageRoute("/Create", "{Slug?}/Create");
});
In some projects, I don't see the AddRazorPagesOption
Just out of curiosity, what would happen if I didn't specify routing like this?
The method options.Conventions.AddPageRoute just help you to define custom routing for your pages. So, the razor page:
Edit will have route template /{Slug}/Edit where Slug is a parameter from the URL.
Delete will have route template /{Slug}/Delete where Slug is a parameter from the URL.
Details will have route template /{Slug?} where Slug is a optional parameter from the URL. Also you can go to that page using /Index.
Create will have route template /{Slug?}/Create where Slug is a optional parameter from the URL.
If you remove them all your razor pages will just use the defaut conventions which is folder base convention started the Pages folder as the root folder. For pages that have parameters you should pass them as query parameter in your request URL. For example without the conventions defined you'll have to use /Edit?slug=myValue if you want to go to the Edit page of myValue item. With the convention configured, the URL is pretty because you'll use /myValue/Edit.
I think the configuration you actually have is just here to avoid having parameters of your razor pages to be passed as query parameter in your request URL.
Does anyone know how to expand this theme ( https://github.com/gilbitron/wp-rest-theme ) in order to theme specific pages? For example, I would like to create a page called "Menu" which has a unique navigation to click through to child pages Breakfast, Lunch, Dinner, etc without reload. I'm used to creating individual .php files to theme specific pages to my liking via page-{slug}.php - Is there an equivalent workflow using vue.js and wp rest api?
Instead of using page-menu.php to customize the /menu page, I would imagine I'd need to create something like a menu-page.vue file and add a custom method to specifically call that page in order to template it.
I can't find any examples of this process. Any help would be greatly appreciated.
What I did was add a field using Advanced Custom Fields that determined which template the page should use. I wrapped the display in a component called PageContent that looks like this:
<div :is="page.template"
:page="page"
v-if="!$loadingRouteData"
transition="fade"
transition-mode="out-in">
</div>
router:
'/:slug': {
component: PageContent,
name: 'Page'
}
So when someone navigates to that route, I fetch the page based on the slug param. The page variable then has a template attribute through ACF, which determines the component to display and defaults to a generic page:
if(pages[0].acf.template){
return pages[0].acf.template;
}
return 'page'
You need the WP JSON API plugin as well as the ACF plugin that adds ACF data to the json
My site uses this setup, happy to share more code if you have more questions.
I added a ArtistsArtistsModuleFrontController on my artists module.
It's working perfectly but I add to go on the back office, section SEO & URL and edit module-artists-artists page to set Titles and URL (for each translations).
This is quite overkill and I would like my module to configure it automatically on installation.
Is this possible? How?
If you doesn't want to use database method, you can set directly meta title, meta description and meta keywords in your controller by set $this->context->smarty->tpl_vars['meta_title']->value
For custom url, you must use hookModuleRoutes : http://blog.belvg.com/how-to-generate-a-custom-url-in-prestashop.html