Home Blog

SEO Language Tags

0

Language Meta Tag

<head>
<meta http-equiv="content-language" content="en-gb" />
</head>

Language HTTP Response Header

Content-Language

HTTP/1.1 200 OK
Content-Language: en-gb

Link

Link: <http://praison.com/file.pdf>; rel="alternate"; hreflang="en",
<http://de-ch.praison.com/file.pdf>; rel="alternate"; hreflang="de-ch",
<http://de.praison.com/file.pdf>; rel="alternate"; hreflang="de"

Language <html> Tag Attribute

<html lang="en-gb">
...
</html>

Language Hreflang Tag

<link rel="alternate" hreflang="en-gb" href="https://praison.com/en-gb/" />

XML Sitemap Tag

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://prasion.com/english/page.html</loc>
<xhtml:link 
rel="alternate"
hreflang="de"
href="https://prasion.com/deutsch/page.html"/>
<xhtml:link 
rel="alternate"
hreflang="de-ch"
href="https://prasion.com/schweiz-deutsch/page.html"/>
<xhtml:link 
rel="alternate"
hreflang="en"
href="https://prasion.com/english/page.html"/>
</url>
<url>
<loc>https://prasion.com/deutsch/page.html</loc>
<xhtml:link 
rel="alternate"
hreflang="de"
href="https://prasion.com/deutsch/page.html"/>
<xhtml:link 
rel="alternate"
hreflang="de-ch"
href="https://prasion.com/schweiz-deutsch/page.html"/>
<xhtml:link 
rel="alternate"
hreflang="en"
href="https://prasion.com/english/page.html"/>
</url>
<url>
<loc>https://prasion.com/schweiz-deutsch/page.html</loc>
<xhtml:link 
rel="alternate"
hreflang="de"
href="https://prasion.com/deutsch/page.html"/>
<xhtml:link 
rel="alternate"
hreflang="de-ch"
href="https://prasion.com/schweiz-deutsch/page.html"/>
<xhtml:link 
rel="alternate"
hreflang="en"
href="https://prasion.com/english/page.html"/>
</url>
</urlset>

 

Python Redirect Path

0
import requests 
s = requests.Session()
response = s.get("https://google.com/")
cookies = dict(response.cookies)
if response.history:
    print ("Request was redirected")
    for resp in response.history:
        print (resp.status_code, resp.url)
    print ("Final destination:")
    print (response.status_code, response.url)
else:
    print ("Request was not redirected")

Selenium Firefox Webdriver Python Setup

0

Python Code

#Packages

from bs4 import BeautifulSoup
import requests
import pandas as pd
import numpy as np
import csv
import re
from selenium import webdriver


#driver = webdriver.Firefox(capabilities={"marionette":False})
caps = webdriver.DesiredCapabilities.FIREFOX
caps["marionette"] = False
driver = webdriver.Firefox(capabilities=caps)


driver.get("https://www.google.com")

print (driver.title)

Python Code with Headless Firefox

 

#Packages

from bs4 import BeautifulSoup
import requests
import pandas as pd
import numpy as np
import csv
import re
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument("--headless")


#driver = webdriver.Firefox(capabilities={"marionette":False})
caps = webdriver.DesiredCapabilities.FIREFOX
caps["marionette"] = False
driver = webdriver.Firefox(capabilities=caps, firefox_options=options)


driver.get("https://www.google.com")

print (driver.title)

WebDriverException: Message: Can’t load the profile

Try,

caps["marionette"] = True




Get all Divs using Selenium Driver Python

X Path

divs = driver.find_elements_by_xpath('//li/div')

CSS Selector

divs = driver.find_elements_by_css_selector('li > div')

Nginx

0

check syntax of Nginx’s configuration files

nginx -t -c /etc/nginx/nginx.conf

Debug Command

 $ service nginx configtest

Apache Server Port number Check

netstat -ntpl |grep httpd

JavaScript get child Element

0

Getting inner Div

var mainDiv = document.getElementById('mainDiv'),
childDiv = mainDiv.getElementsByTagName('div')[0],
requiredDiv = childDiv.getElementsByTagName('div')[1];

 

is_front_page() && is_home() WordPress Default, Static and Blog Page

0
if ( is_front_page() && is_home() ) {
 // Default homepage

} elseif ( is_front_page()){
 //Static homepage

} elseif ( is_home()){

//Blog page

} else {

//everything else

}

gulpfile.js Example SASS CSS

0

Example of gulpfile.js compiling SASS to CSS

Add Bootstrap to WordPress admin sub-menu page

0

Add Bootstrap to a plugin page

// custom css and js
 add_action('admin_enqueue_scripts', 'cstm_css_and_js');

function cstm_css_and_js($hook) {
     // your-slug => The slug name to refer to this menu used in "add_submenu_page"
     // tools_page => refers to Tools top menu, so it's a Tools' sub-menu page
     if ( 'tools_page_your-slug' != $hook ) {
         return;
     }

    wp_enqueue_style('boot_css', plugins_url('inc/bootstrap.css',__FILE__ ));
     wp_enqueue_script('boot_js', plugins_url('inc/bootstrap.js',__FILE__ ));
 }

Synchronising between Git and SVN

0

Synchronizing updates between the two repositories.

1. Clone the GitHub Repo

SSH

$ git clone git@github.com:Praison/seo-wordpress.git

HTTPS

$ git clone https://github.com/Praison/seo-wordpress.git

2. Change into the Directory

$ cd seo-wordpress

3. Set Up a Subversion tracking branch

$ git branch --no-track svnsync 
$ git checkout svnsync
$ git svn init -s https://plugins.svn.wordpress.org/seo-wordpress/ --prefix=origin/
$ git svn fetch --log-window-size 10000 #CAUTION THIS LINE TAKES A LONG TIME TO COMPLETE
$ git reset --hard origin/trunk

4. Merge changes from Subversion to GitHub

$ git checkout svnsync
$ git svn rebase 
$ git checkout master 
$ git merge svnsync 
$ git push origin master

5. Merge changes from GitHub and publish to SubVersion

$ git checkout master
$ git pull origin master 
$ git checkout svnsync 
$ git svn rebase 
$ git merge --no-ff master 
$ git commit 
$ git svn dcommit

### Tagging Releases
Tagging a release in Git is very simple:

$ git tag v1.0.4

To create an SVN tag, simply:

$ git svn tag 1.0.4

This will create `/tags/1.0.4` in the remote SVN repository and copy all the files from the remote `/trunk` into that tag, so be sure to push all the latest code to `/trunk` before creating an SVN tag.

### Subversion tagging

It appears that there is now an issue with git svn tagging. We now have to tag using subversion directly.
Download code from svn Repo

$ svn checkout https://plugins.svn.wordpress.org/stop-web-crawlers/
$ svn cp https://plugins.svn.wordpress.org/stop-web-crawlers/trunk https://plugins.svn.wordpress.org/stop-web-crawlers/tags/1.3.1

Bower JSON Dependencies Installation file

0

Bower.JSON

Bower.JSON file, which is used to Configure the Dependencies