我已经添加了/views/sitemap/index.xml,并希望在转到相关的url时显示它。
class SitemapController < ApplicationController
def index
respond_to do |format|
format.html
format.xml
end
end
end
在routes.rb中
match "sitemap/" => "sitemap#index"
使用Rails 3
当我访问mydomain.com/sitemap/时,
我正在尝试将一个.xml站点地图上传到我的Rails应用程序sitemap.xml。当我这样定义一条路线时:
get "sitemap", to: 'xml#sitemap'
我得到以下错误:
Template is missing
Missing template xml/sitemap, application/sitemap with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Se
我有一个生成sitemap.xml文件的PHP代码块。问题是,每次加载站点页面时,它都会生成文件。代码在我的主模板文件中。
我怎么能告诉PHP只执行这段代码,比如说,每天一次,而不是每次加载模板时?
我不想使用cron选项卡,因为代码需要在模板文件中。为同一帐户上的多个域提取模板文件。所以我需要在代码块上加上一个条件,上面写着only run this code when a page is loaded but only during a certain time frame each day, like from 12 noon to 4pm or something like that。
有些事情不对劲。CodeIgniter...输出不是xml格式的。一小时前我才发现我可以看到sitemap页面,但它不是xml格式.看一看,请帮忙
我有一个名为Sitemap.php的控制器
<?php
class Sitemap extends Controller {
public function __construct(){
require APPROOT.'/views/inc/load_models.php';
}
public function index(){
$this->view('sitemap/index
我有一个工作页面,其中的网址为/jobpage/:categoryname/:companyname/:jobtitle/:jobid。参数是动态生成的。我想在网站地图上所有这些动态生成的链接。我用过express-sitemap包,代码如下-
var sitemap = require('express-sitemap');
sitemap({
sitemap: 'sitemap.xml', // path for .XMLtoFile
robots: 'robots.txt', // path for .TXTtoFile
ge
在一个简单的txt模板中,我遇到了一个非常奇怪的错误。当我将它作为XML提供时,没有错误,因此该错误与模板本身无关,也与所涉及的路由无关。这是游戏中的窃听器吗?(我用的是1.2.4)?
这是请求/robots.txt时的错误消息:
No route found
No route able to invoke action PublicController.sitemap with arguments {} was found.
----------
In /app/views/PublicController/robots.txt (around line 1)
> 1: Site
在命令提示符下运行项目时,我遇到了以下错误
java com.javavids.jaxb.sitemap.main.Main
我得到了以下错误
Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
There's no ObjectFactory with an @XmlElementDecl for the element {unison}FromTim