sitemap

Liftweb Menu customization

落爺英雄遲暮 提交于 2019-12-03 00:34:31
I want to create a menu that looks like: HOME | FOO | BAR | ABOUT | CONTACT How might I go about doing this? Here is what I have tried: <lift:Menu.builder ul:class="menu" li_item:class="current" /> and ul.menu li { display: inline; list-style-type: none; text-transform: uppercase; border-right: 1px solid white; padding-right: 5px; } li.current span { background: white; color: black; padding: 5px 5px 3px 5px; font-size: 11px; } li.current a, a:visited, a:link { color: white; padding: 5px 5px 3px 5px; font-size: 11px; } This gets close, but it doesn't look quite right. Also you end up with an

Scrapy中的Spider

匿名 (未验证) 提交于 2019-12-02 23:51:01
Spider 类定义如何爬取指定的一个或多个网站,包括是否要跟进网页里的链接和如何提取网页内容中的数据。 爬取的过程是类似以下步骤的循环: 1.通过指定的初始URL初始化Request,并指定回调函数。当Request下载完后,生成Response作为参数传给回调函数。初始的Request是通过start_requests()读取start_urls中的URL来生成的,回调函数为parse()。 2.在回调函数中分析Response的内容,返回Item对象或者Request或包含二者的可迭代容器。返回Request对象经过Scrapy处理,下载相应的内容,并调用设置的回调函数。 3.在回调函数中,可以用选择器(或者Beautiful Soup,lxml这些解析器)来分析网页内容,生成Item。 4.生成的Item可以存入数据库,或存入到文件。 1. Spider 类 class scrapy.spiders.Spider:最简单的爬虫类。 方法与属性: name:爬虫名,要唯一。 allowed_domains:允许爬取的域名列表。 start_urls:初始的URL列表。 custom_settings:参数配置字典,必须是类属性,因为参数配置在实例化前被更新。 crawler:此属性是由from_crawler()设置的。 settings:运行此爬虫的设置。 logger

Multiple Sitemap: entries in robots.txt?

一曲冷凌霜 提交于 2019-12-02 23:22:44
I have been searching around using Google but I can't find an answer to this question. A robots.txt file can contain the following line: Sitemap: http://www.mysite.com/sitemapindex.xml but is it possible to specify multiple sitemap index files in the robots.txt and have the search engines recognize that and crawl ALL of the sitemaps referenced in each sitemap index file? For example, will this work: Sitemap: http://www.mysite.com/sitemapindex1.xml Sitemap: http://www.mysite.com/sitemapindex2.xml Sitemap: http://www.mysite.com/sitemapindex3.xml It is possible to write them, but it is up to the

基于django的个人博客网站建立(七)

匿名 (未验证) 提交于 2019-12-02 22:51:08
基于django的个人博客网站建立(七) 前言 这次在原来的基础上添加或修改一些小功能 具体内容 1.代码高亮 在原来的blog-details.html页面添加下面的代码: <link href="http://cdn.bootcss.com/highlight.js/9.12.0/styles/googlecode.min.css" rel="stylesheet"> <script src="http://cdn.bootcss.com/highlight.js/8.0/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> 它会自动高亮由markdown转换成的代码部分,即 <pre><code></code></pre> 2.统计文章阅读数量 通过在用户浏览器上存储唯一id来保证识别用户 每篇文章每个浏览器只能够每天一次增加浏览数目 首先先为article表添加浏览数目字段 class Article(models.Model): title = models.CharField(max_length=128) markdownContent = models.TextField(default='') htmlContent = models.TextField() read

Can I include PHP in an XML file?

荒凉一梦 提交于 2019-12-02 18:59:31
问题 I am trying to create an automatic "sitemap.xml", I already followed the instructions provided by Google to create one, and here is what I currently have: <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>http://www.example.com/</loc></url> </urlset> Now, I wanted to replace " <url><loc>http://www.example.com/</loc></url> " with " <?php include ("assets/includes/menu.inc"); ?> " which will include the following: <li><a href="index

用python写网络爬虫(第二版)

我是研究僧i 提交于 2019-12-02 18:51:05
目录 第一章:网络爬虫简介 1.1 网络爬虫何时会有用? 1.2 网络爬虫是否合法? 1.3 python3 1.4 背景调研 1.4.1 检查robots.txt 1.4.2 检查网站地图(sitemap) 1.4.3 估算网站大小 1.4.4 识别网站所有技术 1.4.5 寻找网站所有者 1.5 编写第一个网络爬虫 1.5.1 抓取与爬取的对比 1.5.2 下载网页 1.5.3 网站地图爬虫 1.5.4 ID便历爬虫 1.5.5 链接爬虫 1.5.6 使用 request库 1.6 本章小结 示例网站: http://example.python-scraping.com 资源提供: https://www.epubit.com/ 第一章:网络爬虫简介 1.1 网络爬虫何时会有用? 以结构化的格式,获取网上的批量数据(理论上可以手工,但是自动化可以省时省力) 1.2 网络爬虫是否合法? 被抓取的数据用于个人用途,且在合理使用版权法的条件下,通常没有问题 1.3 python3 工具: anaconda virtual environment wrapper ( https://virtuallenvwrapper.readthedocs.io/en/latest ) conda ( https://conda.io/docs/intro.html ) python 版本

How to efficiently serve massive sitemaps in django

瘦欲@ 提交于 2019-12-02 18:19:13
I have a site with about 150K pages in its sitemap. I'm using the sitemap index generator to make the sitemaps, but really, I need a way of caching it, because building the 150 sitemaps of 1,000 links each is brutal on my server.[1] I COULD cache each of these sitemap pages with memcached, which is what I'm using elsewhere on the site...however, this is so many sitemaps that it would completely fill memcached....so that doesn't work. What I think I need is a way to use the database as the cache for these, and to only generate them when there are changes to them (which as a result of the

Serving sitemap.xml and robots.txt with Spring MVC

半城伤御伤魂 提交于 2019-12-02 15:56:37
What is the best way to server sitemap.xml and robots.txt with Spring MVC ? I want server these files through Controller in cleanest way. I'm relying on JAXB to generate the sitemap.xml for me. My controller looks something like the below, and I have some database tables to keep track of the links that I want to appear in the sitemap:- SitemapController.java @Controller public class SitemapController { @RequestMapping(value = "/sitemap.xml", method = RequestMethod.GET) @ResponseBody public XmlUrlSet main() { XmlUrlSet xmlUrlSet = new XmlUrlSet(); create(xmlUrlSet, "", XmlUrl.Priority.HIGH);

Can I include PHP in an XML file?

情到浓时终转凉″ 提交于 2019-12-02 11:09:16
I am trying to create an automatic "sitemap.xml", I already followed the instructions provided by Google to create one, and here is what I currently have: <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>http://www.example.com/</loc></url> </urlset> Now, I wanted to replace " <url><loc>http://www.example.com/</loc></url> " with " <?php include ("assets/includes/menu.inc"); ?> " which will include the following: <li><a href="index.php">Home</a></li> <li class="subMenu"><a href="gallery.php">Gallery</a> <ul> <li><a href="404.php">404

How can I remove nodes from a SiteMapNodeCollection?

回眸只為那壹抹淺笑 提交于 2019-12-02 10:59:18
问题 I've got a Repeater that lists all the web.sitemap child pages on an ASP.NET page. Its DataSource is a SiteMapNodeCollection . But, I don't want my registration form page to show up there. Dim Children As SiteMapNodeCollection = SiteMap.CurrentNode.ChildNodes 'remove registration page from collection For Each n As SiteMapNode In SiteMap.CurrentNode.ChildNodes If n.Url = "/Registration.aspx" Then Children.Remove(n) End If Next RepeaterSubordinatePages.DataSource = Children The