Setup Schema.org application to host an extension - schema.org

I try to host my extension of schema.org with schema.org application https://github.com/schemaorg/schemaorg.
But I can't figure where I should placed my rdfa file to achieve this.
Will be cool to have ability to show my extension terms separetely like it's done for bib extension, please see image
http://soil.by/screen/upload/screen_006.jpg

I found a workaround solution to place your extension like an schema.org hosted extension. It solve a problem, but have some inconvience.
To your extension has been read you need add additional element to
sdoapp.py
ENABLED_EXTENSIONS = [ 'auto', 'bib', '%YOUR_EXT_NAME%' ]
ALL_LAYERS = [ 'core', 'auto', 'bib', '%YOUR_EXT_NAME%']
After that you can place your rdfa into data/ext/%YOUR_EXT_NAME%/any_file_name.rdfa
RDFa should describe terms with schema:isPartOf property in this way
<div typeof="rdfs:Class" resource="http://schema.org/AnEntity">
<link property="http://schema.org/isPartOf" href="http://%YOUR_EXT_NAME%.schema.org"/>
</div>
The main disadvantage is that your terms now will be accessible via additional subdomain.
For example you host your extension under http://schema.example.com
Your terms will be accessiable under
http://%YOUR_EXT_NAME%.schema.example.com/AnEntity
and it's not very good

Related

Is there a way for SvelteKit components to have corresponding endpoint files?

I have a SvelteKit Component that needs a corresponding +page.server.ts for cookie authenticated form actions. My goal is to have a Component with a corresponding delete button that will send an API request to my backend from within a form action inside a +page.server.ts endpoint.
My structure for some clarity:
- src/
- components/
- Component/
- +page.svelte
- +page.server.ts
- routes/
- route/
- +page.svelte
Component +page.svelte:
<div class="card">
<form method="POST">
<input type="hidden" value="{uuid}" name="uuid" />
<button class="btn-icon variant-filled-primary">
<span><Icon icon="material-symbols:delete-outline"></Icon></span>
</button>
</form>
</div>
Component +page.server.ts:
import type { Actions } from './$types';
export const actions = {
default: async ({ cookies, request }) => {
// Doing some http-only Cookie authenticated fetching and data processing here
}
} satisfies Actions;
The component is being rendered as perfectly fine as it did when I was still using just Component.svelte as my structure/nomenclature without a dedicated folder and +page.svelte.
The error I'm getting from within my browser after clicking the submit button in the component goes as follows:
405 POST method not allowed. No actions exist for this page
I figured this behaviour may appear since I don't have any form actions specified for my Routes +page.svelte but for my Components +page.svelte which, for whatever reason, won't be executed when clicking the form submit button.
Is my approach to this problem even possible of a solution or am I being forced right here to roll back and just use Route Form Actions from within every single route that utilizes my component? Doesn't seem like a very scalable option to me.
One thing to keep in mind with Sveltekit is that you get a lot of "magic" in the name of keeping things easy to use and on the happy path. The whole framework is designed around that premise and makes use of conventions to get it done.
Your src/routes directory is a convention that the whole router is built around, so anything that needs to execute routing behavior out of the box needs to be inside that directory. However, you still have a large amount of flexibility in how it all gets put together. In this case you have a couple of options.
Options 1: API Routes
As people have mentioned in the comments, you can use the routes directory to build out an API structure independent of any .svelte files that will render. A common structure would be something like this, which would create a standard endpoint route:
- src/
- routes/
- api/
- delete/
- +server.js
Inside the +server.js file you can build out standard handlers for GET, POST, etc. Then you can call the endpoint as a relative path from the root path, anywhere in the app and from any component using fetch, and you can also call it from other +page.js and +*.server.js files. In this case the route is reached with the path /api/delete.
Option 2: Co-locate components with routes
Another option if the component only relates to one route is to co-locate the component in the routes directory. If it doesn't have the + prefix it will be ignored by the router. This makes the following structure valid:
- src/
- routes/
- route/
- FormComponent.svelte
- +page.svelte
- +page.server.js
- utilities.js
In this case, both the FormComponent and the utilities files are ignored by the router, but both are still accessible from other files in the route. In cases where you need to decompose pieces of a page for reuse in that page, but those pieces only apply to the route in question, this can massively simplify your dependency map between files. Note that files placed in routes using this pattern can still be used elsewhere with standard relative path imports, but if you need to access them somewhere else they are probably better off living in the $lib directory.
A note about the official docs
I have found that the official docs are complete, but are also very succinct. There isn't a lot in the way of code examples, just enough to get you going. It's a great resource for reference but it can be challenging for discovery. Also an understanding of vanilla Svelte is assumed throughout, along with an understanding of HTTP conventions and web standards.
With that in mind, asking question here is encouraged, along with the official Svelte discord community which also covers Sveltekit. I've also found the Reddit community to be very helpful.

Using Svelte JS framework with a Web Component library, how can I accomplish two-binding with the custom elements via the bind:value directive?

Note: There is a GitHub issue open on the Svelte repo for this very question.
https://github.com/sveltejs/svelte/issues/4838
While I understand that this may or may not someday become a feature of Svelte, what I am asking is how I can create a workaround today to support a third-party web component library like Shoelace or UI5, or Ionic with two-way binding?
Synopsis:
I have set up a Svelte app and successfully added a Web Component Library (Ex: Shoelace).
I write a line of code that uses two-way binding like:
<sl-input name="name" type="text" label="Name" bind:value={name}/>
I cannot two-way bind (bind:value={}) because the Svelte compiler doesn't recognize the valid bindings for the custom web components.
If there were a wrapper library that you know of, or some other thing I could do to make it work, that would be great.
I am not sure if this will work with libraries but it is worth a shot. For my custom component I just followed this answer.
Add this in your custom component:
<script>
export let onValueChange;
export let value;
$: onValueChange(value);
</script>
And add this when using the component (it will give an error until you add this)
<custom-component onValueChange="{(x) => value = x}"/>

Meteor path helper not returning anything

to learn meteor, I'm following Sacha Greif's book 'Discovering Meteor'. The current source code is reflected here-> https://github.com/stopachka/meteor-hackernews
Right now, I'm trying to add a 'discuss' link to the post_item, which is supposed to render the single post_item.
<template name="postItem">
<div class="post">
<div class="post-content">
<h3>{{title}}<span>{{domain}}</span></h3>
</div>
Discuss
</div>
</template>
The router looks like so ->
Meteor.Router.add
'/': 'postsList'
'/posts/:_id':
to: 'postPage'
and: (id) ->
Session.set('currentPostId', id)
Currently, If I type in to the browser
localhost:3000/posts/foobarid
It renders the corresponding post
But when i add the {{postPagePath title}}, the discuss button does not even show the href property. I'm assuming it's because it's not rendering anything.
Super new to Meteor here, any guidance greatly appreciated
A couple of points to note here:
First, the router package you are using with the tutorial, Meteor Router, has been deprecated in favor of a now-canonical routing package for Meteor, Iron Router. You can see this noted on the Meteor Router github page here, and you can find the Iron Router specifications here. I suspect you may be using an older version of the Discover Meteor book as well, as it now covers Iron Router in detail. If at all possible, I'd try to get my hands on a version of the book covering Iron Router as it will be the standard for the foreseeable future.
Second, you are correct that that href="" property is not showing up because it is not rendering anything. Specifically, in Meteor 0.8+, if the value of an attribute returns null, undefined or false, the attribute itself is removed. Read more here.
Lastly, while I'm not up to speed on the details of Meteor Router it looks on quick inspection like you would want to pass PostPagePath the id and not the title of the post, e.g. {{PostPagePath id}} or similar.
I ran into a similar issue with Router and discovered it had been deprecated
For me, the resolution was to install meteorite and add Iron-Router:
mrt add iron-router
Then you can route as follows:
Router.map(function() {
this.route('postslist', {path: '/'})
//read the docs for your next routing needs
});
I am assuming you already have meteorite installed, if you haven't and are using uBuntu or similar flavor you can easily setup using the following:
export PATH=~/.meteor/tools/latest/bin:$PATH //ensure you are in your project root directory
npm install -g meteorite //must have npm installed
Figured this out from this stackoverflow link

In TYPO3 6.x, how to get defaultJS, when config.disableAllHeaderCode is enabled?

I set config.disableAllHeaderCode = 1 in my recent TYPO3 sites, as I want full control over the page template.
But this not only throws out the html tag etc., but also the default Js (which could be used to uncrypt mailto-Links.
One solution would be to copy this TYPO3-generated JS from the core code and insert it manually. Very simple: just set config.disableAllHeaderCode = 0, load the page once, copy the js, done. But, in case of an update or settings change, this might break.
So: is it possible to access this "default JS" via typoscript and assign it to the PAGE object?
Have a look at https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/Page/PageGenerator.php. You will see that the spam protection code is hardcoded and only added to the page output if config.disableAllHeaderCode is not set.
Therefore I don't see a possibility to do that. Therefore the answer seems to be no, unless you XCLASS the PageGenerator. I would just copy the JavaScript code; I'm using TYPO3 for some years now and wouldn't remember that the spam protection code ever changed.
There is a solution I think. Go to /typo3/sysext/cms/tslib/templates. There is a file tslib_page_frontend.html. This file is responsible for rendering the whole page including the head. You can define a new path to the above mentioned file. For example set the following code:
config.pageRendererTemplateFile = PATH_TO_YOUR_THEME//Resources/Private/Core/tslib_page_frontend.html
respectively
page.config.pageRendererTemplateFile = PATH_TO_YOUR_THEME//Resources/Private/Core/tslib_page_frontend.html
The new template file can look like the following small snippet:
###JS_INLINE###
###BODY###
That way the inline JS is still rendered (and I think the spam protections JS is inline JS - which can be stored in external files).

Custom Lift tags don't work

The following types of tags in Lift do not seem to work for me:
<lift:snippet type="MyClass:render" />
<lift:MyClass.render/>
<lift:MyClass/>
Using these tags results in a Class Not Found error. If I attempt to call a class using
<div class=lift:myclass.mymethod />
it can work. Or if I call it using span tags. For instance, the Hello World example in Pollak's Simply Lift works for me, successfully displaying the Howdy method with the following code:
<span class="lift:helloWorld.howdy">
Welcome to your Lift app at <span id="time">Time goes here</span>
</span>
Currently, my problem is coming from attempting to implement Exploring Lift's (aka The Lift Book) OpenID example in Chapter 13.1. I have downloaded OpenID4Java using sbt as well as the lift-openid library. That example can be found at http://exploring.liftweb.net/master/index-13.html. I have implemented the change to the Boot class, and created the OpenID class and the SimpleOpenIDVendor class. But creating an html file containing
<lift:OpenID.form>
<openId:renderForm/>
</lift:OpenID.form>
causes the following error to be displayed in the browser:
Error processing snippet: openid.form
Reason: Class Not Found
XML causing this error:
<lift:openid.form xmlns="http://www.w3.org/1999/xhtml">
<openid:renderform>
</openid:renderform></lift:openid.form>
The class OpenID was placed in a package that starts with the package code, which is being implicitly found by Lift. It is included in the Boot.scala file with the line
LiftRules.addToPackages("code")
So, I am at a loss. Any ideas?
Note that other lift tags such as lift:bind-at and lift:surround and the like work fine.
As dave posted under my original comment, the problem was the HTML5 parser. Lift is case-sensitive, and cannot find a class with varying case. Since the HTML5 parser automatically makes tags lowercase, you can't use custom lift tags anymore. Instead, you have to use something like
<div class="Lift:MyClass.render"></div>
Note that you CANNOT have
<div class="Lift:MyClass.render" />
as HTML5 apparently does not support such tags.
My OpenID4Java problem is therefore resolved by using:
<div class="lift:OpenID.renderForm">
</div>
Why I don't need to use openid.form still is uncertain. It could be possible I'm implementing it slightly off, but I confirmed that it will take me to an openid login page if I put in the openid link, so it is indeed functional.
Sources:
http://groups.google.com/forum/#!topic/liftweb/H-xe1uRLW1c
https://groups.google.com/group/liftweb/browse_thread/thread/3948df1eee6ec271/ (thanks fmpwizard)