vue-cli-plugin-prerender-spa | Boost SEO by prerendering your Vue application | Search Engine Optimization library
kandi X-RAY | vue-cli-plugin-prerender-spa Summary
Support
Quality
Security
License
Reuse
- Attempt to insert a hook .
- Generate a plugin that is exported .
- Generate the plugin
- Create the renderer
- patch event with programmatically
- Insert an event .
- Parses the given plugin options .
- Creates the renderer config .
- Resolve static paths
- Creates a native RenderEvent .
vue-cli-plugin-prerender-spa Key Features
vue-cli-plugin-prerender-spa Examples and Code Snippets
Trending Discussions on Search Engine Optimization
Trending Discussions on Search Engine Optimization
QUESTION
ANSWER
Answered 2022-Apr-04 at 16:58Google is able to parse any SPA (even tho, it will not give the best rankings for something JS only).
In your first screenshot we can see that you're loading an index.js
file (your Vue app), so if you have it hosted + exposed on a URL like https://musiccart.store/, yep Google will crawl it and make it available to everybody.
Not sure what you mean by tags, but by default: nothing more is required by Google to crawl your website.
You could have used a robots.txt file or host it somewhere protected with a password (or just behind a sneaky URL preview like on Netlify).
QUESTION
I'm following the documentation for seo of https://nuxtjs.org/docs/features/meta-tags-seo/ in a netifly hosted nuxt project wwww.estudiosclaw.com
the problem when i run the lighthouse checker in chrome it says the meta description is empty ( apeears in the head of the html ).
when i retieve a especific post directly all checks are red.
in google search typing "estudios claw" only appears the navbar titles.
I have set all my meta description individually depending the page.
example:
head() {
return {
title: `${this.about.data.attributes.title}`,
meta: [
{
hid: "description",
name: `${this.about.data.attributes.title} - Estudios Claw`,
content: `${this.about.data.attributes.description}`,
},
],
};
},
ANSWER
Answered 2022-Mar-22 at 14:38You need to generate a meta tag like . Your code would not do that. The example code you linked to shows that both the
hid
and the name
should be "description"
(literally.) You appear to be putting the page title into the name
attribute of the tag, which is not correct. Correct code should be more like:
head() {
return {
title: `${this.about.data.attributes.title} - Estudios Claw`,
meta: [
{
hid: "description",
name: "description",
content: `${this.about.data.attributes.description}`,
},
],
};
},
QUESTION
I have a website composed as follows:
index.php
page1.php
page2.php
page3.php
- images
image1.jpg
image2.jpg
- style
style.css
I want to write an htaccess file which can give me SEO friendly URL. In example:
https://example.com/page2.php
should behttps://example.com/page2
and also:
https://example.com/page2.php#mytab
should behttps://example.com/page2#mytab
But I would like to apply those rules only on the first directory, so "images" and "style" dirs can continue to be reached using the extensions.
Can somebody help? Thanks
ANSWER
Answered 2022-Mar-07 at 23:45You should already be linking to the files without the
.php
extension on your internal URLs (ie.href="/page1"
, nothref="/page1.php"
). I'm also assuming that your URLs don't otherwise contain dots (which normally delimits the file extension).Implement a rewrite to append the
.php
extension if required. This needs to go near the top of the root.htaccess
file:
RewriteEngine On
# Internally rewrite extenionless URLs to append ".php" if required
# Tests only requests (that do not contain a dot) in the root directory
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([^./]+)$ $1.php [L]
Alternative for the RewriteCond
(filesystem check):
RewriteCond %{REQUEST_FILENAME}.php -f
:
Alternatively, you could remove the RewriteCond
directive altogether to unconditionally rewrite all requests in the root (without a file extension) to append the .php
extension.
(OPTIONAL) If you are changing a URL structure and removing .php
from your URLs and the old URLs have been indexed by search engines and/or linked to by third parties then you need to also implement a redirect to remove the .php
extension for SEO.
Add the following immediately after the RewriteEngine
directive above (before the internal rewrite):
# Redirect to remove the `.php` extension inbound requests
# Only affects the root directory
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^([^./]+)\.php$ /$1 [R=301,L]
The condition that tests against the REDIRECT_STATUS
environment variable ensures we don't redirect already rewritten requests by the later rewrite and this avoiding a redirect loop.
NB: Test first with a 302 (temporary) redirect to avoid potential caching issues.
Alternatively (instead of #3), to prevent direct access to the .php
file and serve a 404 Not Found instead then add the following immediately after the RewriteEngine
directive above (before the internal rewrite):
# Prevent direct access to ".php" file and serve a 404 instead
# Only affects the root directory
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^([^./]+)\.php$ - [R=404]
what is the best way to show the content of my custom 404 page every time a 404 error occurs? (I would not like to use redirect)
Use the following at the top of the .htaccess
file, passing the full URL-path to the ErrorDocument
directive.
ErrorDocument 404 /error-docs/e404.php
The stated error document is called using an internal subrequest (there is no external redirect).
Note that this should include the .php
file extension here - this is entirely invisible to the user.
QUESTION
Let's say I've got two webpages page1
and page2
. Now, I would like to have an animation (using css transition) to transform page1
into page2
or page2
into page1
if the user navigates from page1
to page2
or from page2
to page1
respectively. Moreover, I would like that search engines can find both pages.
Use actually only one page
page.html
with hashes:page.html#page1
andpage.html#page2
. For example by listening for ahashchange
event the transition can be done easily.Use parameters:
page.html?content=page1
andpage.html?content=page2
. A complete reload of the page can be avoided by thepreventDefault
method orhistory.pushState
.
As far as I know, in the first solution, search engines are not going to show my pages as separate links. Also, both solutions have the following major problem: What happens if someone writes simply page.html
into the browser's address field or – even worse – page.html
appears as a link in search results? I really would like that page.html
doesn't exist at all, but that seems impossible given the above solutions.
So, the best solution I could think of so far, is having actually two pages page1.html
and page2.html
that have both exactly the same content (that is, the content of both pages combined). E.g. in page1.html
the content of page2
would have property display: none
. Now, when a user navigates from page1
to page2
, I use history.pushState
to set the new URL. While I believe this should in principle work, I'm concerned about having two identical pages or hiding large amounts of a page using display: none
as both is supposed to be bad for SEO.
Any answer that addresses at least part of my problem is very welcome! Maybe there is a way to at least prevent search engines from finding page.html
in my second solution? Or maybe there is a solution I'm completely unaware of?
ANSWER
Answered 2022-Mar-02 at 23:33Your history.pushState
way is fine. Once a user visits page a, preload page b with JavaScript, and you can apply your CSS transitions that way. You could do something like:
(async () => {
const page2 = await fetch("/page2.html");
const text = page2.text();
// dummy event listener and selector
document.querySelector('a[href="/page2.html"]').addEventListener("click", e => {
e.preventDefault();
// apply CSS transitions by adding classes or whatever
document.documentElement.innerHTML = text;
history.pushState(null, null, "/page2.html");
});
})();
This way you don't have to change any of your HTML or CSS and no SEO will be affected. This can also improve your UX by cutting off load times to other pages, kind of like what React Router or NextJS does.
QUESTION
I am a web developer who also works in SEO. I want to 301 redirect one page to another page. Is this 301 redirect for Google beyond what I write below for you?
In JavaScript:
In PHP:
Are these two 301 redirects, or do we have to write .htaccess
in the cat file, for example?
ANSWER
Answered 2022-Feb-28 at 12:45You can not do this with JavaScript.
But you can use PHP as follows
Syntax header
header(header, replace, http_response_code)
QUESTION
Could you tell me please, what is the best way to add/update SEO metakeywords programmatically?
i looked it up and found on this article how to update meta title and meta desc : https://ehikioya.com/how-to-update-yoast-seo-fields-programmatically/
when i tried to update the meta key words with the same code it wont work.
$updated_title = update_post_meta($post_id, ‘_yoast_wpseo_title’, $metatitle); //working
$updated_desc = update_post_meta($post_id, ‘_yoast_wpseo_metadesc’, $metadesc); //working
$updated_kw = update_post_meta($post_id, ‘_yoast_wpseo_metakeywords’, $metakeywords); // not working
I’m writing a plugin for import products and categories in WooCommerce.
ANSWER
Answered 2022-Jan-22 at 01:52after few hours i found the right key, if anyone ever come across this issue here is the soultion.
using the key : "_yoast_wpseo_focuskw"
$updated_kw = update_post_meta($product_id, '_yoast_wpseo_focuskw', $metakeywords);
QUESTION
I have a requirement to rewrite all URLs to lowercase.
E.g. test.com/CHILD
to test.com/child
Frontend application is developed on docker on azure kubernetes services. Ingress is controlled on nginx ingress controller.
ANSWER
Answered 2021-Oct-05 at 22:32The ingress controller supports case insensitive regular expressions in the spec.rules.http.paths.path
field. This can be enabled by setting the nginx.ingress.kubernetes.io/use-regex
annotation to true (the default is false). For more information please check here
Using the nginx.ingress.kubernetes.io/use-regex
annotation will indicate whether or not the paths defined on an Ingress use regular expressions. The default value is false.
The following will indicate that regular expression paths are being used:
nginx.ingress.kubernetes.io/use-regex: "true"
The following will indicate that regular expression paths are not being used:
nginx.ingress.kubernetes.io/use-regex: "false"
When this annotation is set to true
, the case insensitive regular expression location modifier will be enforced on ALL paths for a given host regardless of what Ingress they are defined on.
QUESTION
ANSWER
Answered 2022-Jan-07 at 19:55That happens because a ReactJS is rendered using JS. It means that the DOM will be updated using JS. When you open it with ctrl + U you're looking only to the HTML document, without any changes made by the JS engine.
I don't think leaving it like this will affect SEO, but you you can use server-side rendering to achieve what you want.
QUESTION
In my [id].tsx
page I have the following meta tag structure
{imageUrl && }
However in my production server, when I scrape an article using the Facebook debugger I get the following error
But when I check for an article in my development server, the proper image shows even though the code is the same as production
I also do have the following line in my _app.tsx
file that I think may be causing the error but am not sure
And the truly strange thing is that if I share my production article links on kakao, the thumbnail image shows up fine, but on Facebook and LinkedIn, the thumbnail image does not show up properly.
Does anyone know why my meta tags are scraped differently on my production and development servers when the code applied is exactly the same?
How my imageUrl is generated
I get archive
data from a third party API (strapi) using useSWR
const { data: archive, error } = useSWR('/archives/' + router.query.id, (url) => {
return axios.get(url).then(res => res.data)
}, {
initialData: props.data
})
I then get my images
from the archives
and if images
exist, I get my imageUrl
const images = archive.images
let imageUrl = ''
if (images && images.length > 0) {
imageUrl = getCloundFrontUrl(images[0].url)
}
I then use the getCloundFrontUrl
function to replace the url with my cdn
export const getCloundFrontUrl = (url) => {
return url ? url.replace('poomgo-homepage.s3.ap-northeast-2.amazonaws.com', 'cdn-hp.poomgo.com') : ''
}
ANSWER
Answered 2021-Dec-22 at 02:16I removed the
from my _app.tsx
and the issue was resolved. Pretty sure that the code above signalled redirects to my home page from every page on production which caused the wrong og:image
QUESTION
I am trying to convert string to seo friendly url. For this I have written below code and set the table column collation type to utf8_general_ci It is working for English but not working for Bengali Language. Just outputting single hypen(-) for bengali string
function seo_url( $string, $separator = '-' )
{
$accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i';
$special_cases = array( '&' => 'and', "'" => '');
$string = mb_strtolower( trim( $string ), 'UTF-8' );
$string = str_replace( array_keys($special_cases), array_values( $special_cases), $string );
$string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) );
$string = preg_replace("/[^a-z0-9]/u", "$separator", $string);
$string = preg_replace("/[$separator]+/u", "$separator", $string);
return $string;
}
Is there any solution for unicode like bengali language for the same
ANSWER
Answered 2021-Dec-10 at 10:44To accept glyph in Bengali (or any other language) you have to change the regex on this line :
$string = preg_replace("/[^a-z0-9]/u", "$separator", $string);
Currently, it means "change any character wich in not a letter or a number by a -". By another regex asking "change any character wich is not a letter or a number in any language" :
$string = preg_replace("/[^\p{L}\p{M}]/u", "$separator", $string);
Changing this line, your function will work fine ! More information and related anwser here : https://stackoverflow.com/a/6005511/15282066
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install vue-cli-plugin-prerender-spa
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page