I'm using this code to create a xml sitemap on a multidomain website (.de and .com):
plugin.tx_seo {
config {
xmlSitemap {
sitemaps {
pages {
config {
excludedDoktypes = 137, 138
additionalWhere = AND (no_index = 0 OR no_follow = 0)
}
}
}
}
}
}
The result is a XML-file to the real sitemap. Is this valid?
.../sitemap.xml:
The real sitemap when I click the link (.../sitemap.xml?sitemap=pages&cHash=d65c2c32882eb9d88ac8d6050159a9c7)
Yes, that's allowed: https://www.sitemaps.org/de/protocol.html#index
In short: for larger websites, you should split your sitemap into multiple files. It's also a possibility if you have different kinds of content and the sitemaps need to be generated separately (e.g. news records and pages)
Related
My company is using the new GitHub projects beta and we're really enjoying the experience, but we're facing a problem and it is how to export the data from a specific view (or even all the data) with all the custom columns that we have.
The ideal solution for us is to get this same data as JSON using the API.
Using https://api.github.com/orgs/.../issues does not work because the issues does not have the custom columns that we create inside the project, and https://api.github.com/orgs/.../projects does not have the data of the issues.
Any idea or work-around to get this data easily using APIs?
After reading the feedback post on GitHub, it's not possible to do it with API, just GraphQL, at least for now.
So my problem was solved with this useful code.
To get the first 100 project from your organization and their ID:
query{
organization(login: "MY_ORG") {
projectsNext(first: 20) {
nodes {
id
title
}
}
}
}
To get the first 100 issues and drafts from a specific project:
{
node(id: "My_Project_ID") {
... on ProjectNext {
items(first: 100, after: null) {
edges {
cursor
}
nodes {
content {
... on Issue {
title
assignees(first: 1) {
nodes {
login
}
}
milestone {
title
}
labels(first: 5) {
nodes {
name
}
}
repository{
name
}
}
}
fieldValues(first: 15) {
nodes {
value
projectField {
name
settings
}
}
}
}
}
}
}
}
Those codes can be easily tested in THIS LINK
Our company has multiple brands and each brand has its own host name, but they are all part of the same site. We can let customers share baskets and other session information when they switch between brands via a redirect link using URLUtils.sessionRedirect.
But URLUtils is not available in content assets. Is it possible to form a session redirect link in content asset keeping all the session information?
Thanks in advance.
You can include dynamic content in Content Assets with the $include('Controller-Name', 'name1', 'value1', 'name2', 'value2', ...)$ syntax. See the MarkupText Class Documentation for more info on that syntax. The 'name1' and 'value1' parameters are mapped as query string attributes eg: Controller-Name?name1=value1&name2=value2
Create a controller that outputs the session redirect link you need, and call it via that syntax like: $include(Util-RenderSessionLink, 'siteID', 'foo')$
The controller would need to use a response Content-Type header of text/plain or something like that so that nothing is injected into the response. (eg: Storefront toolkit or tracking tags) For example:
response.setContentType('text/plain');
Alternatively, you could process the content asset for some sorts of keys that you perform find & replace operations on. For example, the following code does a find & replace on a Content Asset's body content for the key: '%%SessionLink%%'.
var ContentMgr = require('dw/content/ContentMgr');
var URLUtils = require('dw/web/URLUtils');
if (!empty(content) {
var content = ContentMgr.getContent('my-content-id');
var contentOut = "";
var viewData = {};
contentOut = content.custom.body.getMarkup()
.replace('%%SessionLink%%', URLUtils.sessionRedirect(...));
viewData.content = contentOut;
// then output your `pdict.content` key within a template with the appropriate encoding
}
If anybody else is running into this, we added a bit of client-side javascript that pickups up all outbound links and if it's one of our domains it sends them through a session redirect. This way we don't need content managers to fix very link between domains:
var domains = ["domaina.com", "domainb.com", "domainc.com"]
var sessionRedirectBase = '/s/Our-Site/dw/shared_session_redirect';
$(document).on("click.crossSite", "a", (e) => {
const href = $(e.currentTarget).attr("href");
if (href) { //does the link have a href
if (href.match(/^(http(s)?:)?\/\//)) { //is href an absolute url
const url = new URL(href);
if (url.hostname != window.location.hostname && domains.indexOf(url.hostname) > -1) { //is hostname not the current one and part of the domains array
e.preventDefault();
const sessionRedirect = `${sessionRedirectBase}?url=${encodeURIComponent(href)}`
window.location = sessionRedirect;
}
}
}
});
I am trying to automate some stuff that will require to get the current images from a GitHub private repo.
Ideally, I'd iterate over the root directory and, for all images, get the URL for the RAW file.
For example:
For this image: https://github.com/Flow2015/logo/blob/master/flowImage01.jpg
I would like to get https://raw.githubusercontent.com/Flow2015/logo/master/flowImage01.jpg
If the URL is not available, I could get around with getting the binary content. However, I couldn't find a way to do that either.
As an example, this is basically how I am "finding" files that I want de details of.
{
repository(owner: "Flow2015", name: "logo") {
name
object(expression: "master:") {
... on Tree {
entries {
name
object{
... on Blob {
text
}
}
}
}
}
}
}
I understand that I could build the URL using Repo/branch/filename, I'm just trying to find a safe way if there is one.
How can I solve issue of missing static content when serving html from Spray (or Akka-Http) ? Base url of my service is /api (even though it should be irrelevant in this case).
Here is my route
get {
pathPrefix("swagger") {
pathEndOrSingleSlash {
getFromResource("swagger-ui/index.html")
} ~
getFromResourceDirectory("swagger-ui")
}
}
Loaded html can find css and js file when I open it as
/api/swagger/
but when I open
/api/swagger (without trailing slash)
loaded html attempts to get content from
/api/css/reset.css instead of /api/swagger/css/reset.css
How should I rewrite my route to cover both cases ?
I ended up adding redirect. If anyone knows more elegant solution please post.
pathPrefix("swagger") {
CachingDirectives.cachingProhibited {
pathEnd {
redirect("/api/swagger/", StatusCodes.TemporaryRedirect)
} ~
pathSingleSlash {
getFromResource("swagger-ui/index.html")
} ~
getFromResourceDirectory("swagger-ui")
}
}
Use the redirectToTrailingSlashIfMissing directive instead.
ref: http://doc.akka.io/docs/akka/2.4/scala/http/routing-dsl/directives/path-directives/redirectToTrailingSlashIfMissing.html
I have the same problem as in this question SharePoint 2013 - display the detail from a list item in a branded page, NOT the default SharePoint details page
but my question is that i don't understand yet how to use this script ?
and how can I retrieve the ID of the item from the url to retrieve his detail ? and how can I represent that informations in my page
Since this is kind of a broad question, a more general answer
Most common ways to access/display data on SharePoint
asp.net webpart
asp.net page
silverlight webpart
sharepoint app based on javascript
with asp.net you would mostly use the SharePoint Object Model, accessing data with either SandBoxed or Form solution, by querying SPSite -> SPWeb -> SPList -> SPListItem, like
using (SPSite site = new SPSite("Url to SharePoint site"))
{
using (SPWeb web = site.OpenWeb("Url to SharePoint web"))
{
SPList list = web.TryGetList("ListName");
SPListItem item = list.GetItemById(ID);
...
or
...
SPQuery query = new SPQuery();
query.Query = '<Where><Eq><FieldRef Name="ID" /><Value Type="Number">ID</Value>';
SPListItemCollection collection = list.GetItems(query);
foreach (SPListItem item in collection) {
...
}
}
}
Silverlight and Javascript either use the Rest services or the SharePoint Client Side Object Model
with Javascript you could use:
- AJAX calls by using the odata compatible Rest services (which partly allows the usage of managed meta data),
- SharePoint CSOM
- The older SOAP service
- The SPDataQuery
The odata webservice allows you to get data based on the following urls:
lists: http://sharepointsite/web/_api/lists
listdetail: http://sharepointsite/web/_api/lists/getbytitle(%27listName%27)
fields: http://sharepointsite/web/_api/lists/getbytitle(%27listName%27)/Fields
Items: http://sharepointsite/web/_api/lists/getbytitle(%27listName%27)/Items
Specific item: http://sharepointsite/web/_api/lists/getbytitle(%27listName%27)/Items?$filter=(ID eq 1)
The returned data is either xml atom feed or json, based on the request headers
provided you use jquery you could use
<script type="text/javascript">
function getItem(list, id, callback) {
var url = _spPageContextInfo.webAbsoluteUrl;
$.ajax({
url: url + '/_api/lists/getbytitle(%27' + list + '%27)/Items(' + id + ')',
header: {
'accept': 'application/json;odata=verbose'
},
complete: function(data, status) {
if (status === 'error') {
// error occured
callback(false);
return;
}
var results = JSON.parse(data.responseText).d.results, i;
callback(true, results);
}
});
}
getItem('listName', 5, function(success, results) {
if (success) {
// results is an array of objects with data
}
});
</script>