具有自定义链接的多语言网站的站点地图

时间:2016-06-01 09:46:07

标签: seo sitemap

我的网站在每个网址链接中都有语言代码,具体取决于用户使用的语言。因此,例如,对于英语用户,网站链接可以是:http://example.com/sk/clanky/,对于斯洛伐克用户,可以是http://example.com/en/articles/

所以有两个不同的链接,但两者都有相同的内容 - 只有文字正在改变。 Sitemap.xml应该有INFOS: Undeploying app: C:\Eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT juin 01, 2016 11:14:29 AM org.apache.catalina.core.ContainerBase removeChild GRAVE: ContainerBase.removeChild: destroy: org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] in state [STARTING_PREP] at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:401) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:291) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1038) at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1537) at org.apache.tomee.catalina.TomcatWebAppBuilder.undeploy(TomcatWebAppBuilder.java:1518) at org.apache.tomee.catalina.TomcatWebAppBuilder.undeployWebApps(TomcatWebAppBuilder.java:762) at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:1982) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:839) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) juin 01, 2016 11:14:30 AM org.apache.openejb.assembler.classic.Assembler destroyApplication INFOS: Undeployed app: C:\Eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT juin 01, 2016 11:14:30 AM org.apache.tomee.catalina.TomcatWebAppBuilder startInternal GRAVE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[] org.apache.openejb.OpenEJBException: Creating application failed: C:\Eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT: javax.validation.spi.ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider; at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NoSuchMethodError: javax.validation.spi.ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider; at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:142) at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:35) at org.apache.bval.jsr303.ConfigurationImpl.doPrivBuildValidatorFactory(ConfigurationImpl.java:252) at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:131) at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:129) at org.apache.bval.jsr303.ConfigurationImpl.run(ConfigurationImpl.java:337) at org.apache.bval.jsr303.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:244) at org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:77) at org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:47) at org.apache.openejb.assembler.classic.LazyValidatorFactory.ensureDelegate(LazyValidatorFactory.java:53) at org.apache.openejb.assembler.classic.LazyValidatorFactory.getFactory(LazyValidatorFactory.java:62) at org.apache.openejb.assembler.classic.Assembler.bindValidators(Assembler.java:891) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:785) ... 14 more juin 01, 2016 11:14:30 AM org.apache.tomee.catalina.TomcatWebAppBuilder init INFOS: ------------------------- localhost -> /jreservation juin 01, 2016 11:14:30 AM org.apache.catalina.core.ContainerBase startInternal GRAVE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1120) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) ... 6 more Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Creating application failed: C:\Eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT: javax.validation.spi.ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider; at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1270) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5472) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 6 more Caused by: org.apache.openejb.OpenEJBException: Creating application failed: C:\Eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT: javax.validation.spi.ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider; at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:843) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:677) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261) ... 12 more Caused by: java.lang.NoSuchMethodError: javax.validation.spi.ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider; at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:142) at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:35) at org.apache.bval.jsr303.ConfigurationImpl.doPrivBuildValidatorFactory(ConfigurationImpl.java:252) at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:131) at org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:129) at org.apache.bval.jsr303.ConfigurationImpl.run(ConfigurationImpl.java:337) at org.apache.bval.jsr303.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:244) at org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:77) at org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:47) at org.apache.openejb.assembler.classic.LazyValidatorFactory.ensureDelegate(LazyValidatorFactory.java:53) at org.apache.openejb.assembler.classic.LazyValidatorFactory.getFactory(LazyValidatorFactory.java:62) at org.apache.openejb.assembler.classic.Assembler.bindValidators(Assembler.java:891) at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:785) ... 14 more ,但是如何为这两种语言制作站点地图?当两个链接都在同一个sitemap.xml文件中时会发生什么?

1 个答案:

答案 0 :(得分:1)

只需在站点地图中添加所有链接并将hreflang添加到其中

EX:

<?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>http://www.example.com/deutsch/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/english/" />
    <xhtml:link rel="alternate" hreflang="de-ch" href="http://www.example.com/schweiz-deutsch/"/>
    <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/" />
  </url>
</urlset>

在hreflang中,您可以指定内容的语言和国家/地区。

或者您可以添加所有链接而不使用hreflang

<?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>http://www.example.com/deutsch/</loc>
    </url>
    <url>
        <loc>http://www.example.com/english/</loc>
    </url>
    <url>
        <loc>http://www.example.com/arabic/</loc>
    </url> 
</urlset>