我正要使用 schema.org 扩展我的模板属性并有以下问题。我可以使用哪个属性指定 EducationalOrganization 类型的开放时间? ?不幸的是,openingHours此处不提供属性(property)。此外,没有类似于EducationalOrganization 类型的类型。
这是我的代码的当前状态:
<div itemscope itemtype="http://schema.org/EducationalOrganization" class="ce_text address block">
<div class="text_container">
<p>
<span>
<strong itemprop="name"><?php echo $this->field('company')->value(); ?></strong><br>
</span>
<p itemscope itemtype="http://schema.org/PostalAddress" itemprop="address">
<span itemprop="streetAddress">
<?php echo $this->field('street')->value(); ?><br>
</span>
<span itemprop="postalCode">
<?php echo $this->field('zipcode')->value(); ?>
</span>
<span itemprop="addressLocality">
<?php echo $this->field('place')->value(); ?>
</span>
</p>
<p>
Aus dem Ausland: <span itemprop="telephone"><?php echo $this->field('phone_foreign')->value(); ?></span><br>
Fax: <span itemprop="telephone"><?php echo $this->field('fax')->value(); ?></span>
</p>
<p itemscope itemtype="??????"> <!-- What type can I use here? -->
<strong>Öffnungszeiten:</strong><br>
Montag bis Donnerstag: <meta itemprop="openingHours" content="Mo-Th 08:00-18:00"><?php echo $this->field('mothu')->value(); ?><br>
Freitag: <meta itemprop="openingHours" content="Fr 08:00-15:00"><?php echo $this->field('fri')->value(); ?>
</p> <!-- Öffnungszeiten Ende -->
</div>
</div>
在这种情况下,我可以使用什么类型来使用 itemprop="openingHours" 属性,或者如果这不可能,是否有其他解决方法?
更新:
我同时选择了这个解决方案。 Google 清楚地读出了它,对我们公司来说更有意义。
<div itemscope itemtype="http://schema.org/Service">
<strong>Öffnungszeiten:</strong><br>
Montag bis Donnerstag: <?php echo $this->field('mothu')->value(); ?><br>
Freitag: <?php echo $this->field('fri')->value(); ?>
<div itemprop="hoursAvailable" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://schema.org/Monday" />
<time itemprop="opens" content="08:00:00"></time>
<time itemprop="closes" content="18:00:00"></time>
</div>
<div itemprop="hoursAvailable" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://schema.org/Tuesday" />
<time itemprop="opens" content="08:00:00"></time>
<time itemprop="closes" content="18:00:00"></time>
</div>
<div itemprop="hoursAvailable" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://schema.org/Wednesday" />
<time itemprop="opens" content="08:00:00"></time>
<time itemprop="closes" content="18:00:00"></time>
</div>
<div itemprop="hoursAvailable" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://schema.org/Thursday" />
<time itemprop="opens" content="08:00:00"></time>
<time itemprop="closes" content="18:00:00"></time>
</div>
<div itemprop="hoursAvailable" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
<link itemprop="dayOfWeek" href="http://schema.org/Friday" />
<time itemprop="opens" content="08:00:00"></time>
<time itemprop="closes" content="15:00:00"></time>
</div>
</div>
最佳答案
创建类似的东西:
<main itemscope itemtype="http://schema.org/EducationalOrganization">
<h1 itemprop="name">Name of Organization</h1>
<section itemprop=contactPoint itemscope itemtype=http://schema.org/ContactPoint>
<h2>Opening hours</h2>
<meta itemprop="hoursAvailable" content="Mo,Tu,We,Th,Fr,Sa,Su 09:00-14:00">
<p>Normally open daily <time datetime="09:00">9am</time>-<time datetime="14:00">2pm</time></p>
</section>
</main>
检查上的结构化数据this Google tool 并设置所需的数据。希望这会有所帮助。
关于html - 结构化数据 (schema.org) - EducationalOrganization 开放时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47281370/
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
我需要检查DateTime是否采用有效的ISO8601格式。喜欢:#iso8601?我检查了ruby是否有特定方法,但没有找到。目前我正在使用date.iso8601==date来检查这个。有什么好的方法吗?编辑解释我的环境,并改变问题的范围。因此,我的项目将使用jsapiFullCalendar,这就是我需要iso8601字符串格式的原因。我想知道更好或正确的方法是什么,以正确的格式将日期保存在数据库中,或者让ActiveRecord完成它们的工作并在我需要时间信息时对其进行操作。 最佳答案 我不太明白你的问题。我假设您想检查
有时我需要处理键/值数据。我不喜欢使用数组,因为它们在大小上没有限制(很容易不小心添加超过2个项目,而且您最终需要稍后验证大小)。此外,0和1的索引变成了魔数(MagicNumber),并且在传达含义方面做得很差(“当我说0时,我的意思是head...”)。散列也不合适,因为可能会不小心添加额外的条目。我写了下面的类来解决这个问题:classPairattr_accessor:head,:taildefinitialize(h,t)@head,@tail=h,tendend它工作得很好并且解决了问题,但我很想知道:Ruby标准库是否已经带有这样一个类? 最佳
这个问题在这里已经有了答案:Railsformattingdate(4个答案)关闭4年前。我想格式化Time.Now函数以显示YYYY-MM-DDHH:MM:SS而不是:“2018-03-0909:47:19+0000”该函数需要放在时间中.现在功能。require‘roo’require‘roo-xls’require‘byebug’file_name=ARGV.first||“Template.xlsx”excel_file=Roo::Spreadsheet.open(“./#{file_name}“,extension::xlsx)xml=Nokogiri::XML::Build
我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.
我正在尝试解析一个CSV文件并使用SQL命令自动为其创建一个表。CSV中的第一行给出了列标题。但我需要推断每个列的类型。Ruby中是否有任何函数可以找到每个字段中内容的类型。例如,CSV行:"12012","Test","1233.22","12:21:22","10/10/2009"应该产生像这样的类型['integer','string','float','time','date']谢谢! 最佳答案 require'time'defto_something(str)if(num=Integer(str)rescueFloat(s
给定一个复杂的对象层次结构,幸运的是它不包含循环引用,我如何实现支持各种格式的序列化?我不是来讨论实际实现的。相反,我正在寻找可能会派上用场的设计模式提示。更准确地说:我正在使用Ruby,我想解析XML和JSON数据以构建复杂的对象层次结构。此外,应该可以将该层次结构序列化为JSON、XML和可能的HTML。我可以为此使用Builder模式吗?在任何提到的情况下,我都有某种结构化数据-无论是在内存中还是文本中-我想用它来构建其他东西。我认为将序列化逻辑与实际业务逻辑分开会很好,这样我以后就可以轻松支持多种XML格式。 最佳答案 我最