I have "/pages/index.xhtml" page. The problem is when i run the application, this index page name doesn't appears at address bar.
It only shows http://localhost:8080/myApplication/. What I want to see is http://localhost:8080/myApplication/pages/index.xhtml
Is there any solution?
here is my welcome file from web.xml
<welcome-file-list>
<welcome-file>pages/index.xhtml</welcome-file>
</welcome-file-list>
You need to send a redirect from / to /pages/index.xhtml. Easiest is to use a real index file with a meta refresh header for this.
First create a /index.xhtml file as follows:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dummy homepage</title>
<meta http-equiv="refresh" content="0; url=pages/index.xhtml" />
</head>
</html>
Then change your <welcome-file> as follows:
<welcome-file>index.xhtml</welcome-file>
This also instantly fixes your bad way of using <welcome-file>. It's not supposed to specify the "home page", but it's supposed to specify the folder's own file which needs to be served when a folder such as / or /foo/ is requested in URL instead of a file.
See also
How to use a sub-folder as web.xml welcome directory
why do i get the protected page instead of the login page?
Related
I’m trying to create a Single page with astro and netlify cms, in which the admin should be able to add/remove/modify the page through /admin, but I’m struggling with the understanding of the folder structure.
So, as far as I know, I need to specify the collection structure in the config.yml file. Something like this. (see attached file)
Which will create a content.md file. Basically it will contain all the info that was created through /admin.
The problem is that I don’t know how and where this content.md file is used. Should I import it manually in the index.astro file or am I wrong?
Thank you in advance 🙂
If you have a Markdown file at src/content/content.md, you will need to import and render it somewhere. It depends which page you want to display this content on, but if you want to show the content on your homepage, this would be src/pages/index.astro.
Here’s an example:
---
// src/pages/index.astro
import { Content, frontmatter } from '../content/content.md';
---
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My homepage</title>
</head>
<body>
<h1>{frontmatter.title}</h1>
<article>
<Content /> <!-- this will render your Markdown body -->
</article>
</body>
</html>
The key things to note here are:
The use of the <Content /> component to render the main Markdown content of your Markdown file
The use of an expression {frontmatter.title} to access the title field from your Netlify CMS config. Other fields would be available in the same way: {frontmatter.description}, {frontmatter.heroImage} etc.
I've just realized that some of my pages have a long DOCTYPE, but most pages have the short DOCTYPE like below. I never add this details myself and in all my Master Pages, I don't see/add the DOCTYPE details. My question is how the DOCTYPE got added and how to make all pages use the same short DOCTYPE. I believe the long DOCTYPE may be the cause to mess up some of my navigation for mobile. Thanks for your input!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<!DOCTYPE html>
<html >
The DOCTYPE is set in the main portal template when using the PortalEngine in Kentico with the code <%=DocType%>. This value comes from the Master page tab inside the Pages application. You can see an example of this on the Creating the master page tutorial in the Kentico documentation.
It's the first field on the tab that you can edit, so you should just be able to set the value to <!DOCTYPE html>.
As far as I am aware, each page that has a master page can specify its own document type, so check out each of your master pages. I think if you check out the link about, this will help you out.
It's also worth checking that no-one has edited the file CMSPages\PortalTemplate.aspx (this is the base for PortalEngine pages). For reference, the beginning of the file normally looks as follows (in Kentico 10):
<%# Page Language="C#" AutoEventWireup="true" Inherits="CMSPages_PortalTemplate"
ValidateRequest="false" MaintainScrollPositionOnPostback="true" EnableEventValidation="false"
Codebehind="PortalTemplate.aspx.cs" %>
<%=DocType%>
<html <%=XHtmlNameSpace%> <%=XmlNamespace%>>
To add to what Matt has said, if your not using Portal method then the changes could be in several different aspx files in the CMSTemplates directory. These templates would have that namespace defined in them if they were a master page template.
<!DOCTYPE html>
add above doctype in very first line of your master page.
refer below link.
https://docs.kentico.com/k9tutorial/creating-the-master-page
hopes it will help
Is there any way to setup Firefox and Chrome to work with escape=false attribute in h:outputText tag. When there is some html that needs to be shown in the browser, Firefox and Chrome show parsed string correctly, but any other links in application are freezed (??).
The example html from db:
<HEAD>
<BASE href="http://"><META content="text/html; charset=utf-8" http-equiv=Content-Type>
<LINK rel=stylesheet type=text/css href=""><META name=GENERATOR content="MSHTML 9.00.8112.16434">
</HEAD>
<BODY><FONT color=#000000 size=2 face="Segoe UI">läuft nicht</FONT></BODY>
Parsed HTML on the page:
läuft nicht
What is very weird, is that in IE everything works (usually it is opposite).
I use primefaces components (v2.2), .xhtml, tomcat 7 and JSF 2.0
You end up with syntactically invalid HTML this way:
<html>
<head></head>
<body>
<head></head>
<body>...</body>
</body>
</html>
This is not right. There can be only one <head> and <body>. The browsers will behave unspecified. You need to remove the entire <head> and the wrapping <body> from that HTML so that you end up with only
<FONT color=#000000 size=2 face="Segoe UI">läuft nicht</FONT>
You'd need to either update the DB to remove unnecessary HTML, or to use Jsoup to parse this piece out on a per-request basis something like as follows:
String bodyContent = Jsoup.parse(htmlFromDB).body().html();
// ...
Alternatively, you could also display it inside a HTML <iframe> instead with help of a servlet. E.g.
<iframe src="htmlFromDBServlet?id=123"></iframe>
Unrelated to the concrete problem:
Storing HTML in a DB is a terrible design.
If the HTML originates from user-controlled input, you've a huge XSS attack hole this way.
The <font> tag is deprecated since 1998.
It seems to me that you're trying to do something that JSF was not really meant to do. Rather than try to insert HTML in your web page, you ought to try having the links already on your page and modifying the "rendered" attribute through an AJAX call.
I have some mathjax enhanced WWW pages on Dropbox (e.g., mathjax_test.html), that are rendered like this
while on localhost they are rendered like this
The code of the page is
<html>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<head>
<title>Test of mathjax</title>
<meta http-equiv="content-type" content="text/html;charset=latin-1"></>
</head>
<body>
We analyze the common case in which the dynamic load can
be expressed by a constant load vector \(\boldsymbol r\)
modulated by an adimensional function of time,
\(f(t)\) (e.g., the seismic excitation can be
described in such terms).
</body>
</html>
Is there something that can be done to have mathjax code rendered correctly when the page is fetched from Dropbox?
The problem is that Dropbox only serves content over https but in your source MathJax.js is loaded via src="http://cdn.mathjax.org/....
Browsers block such http calls (see this SO post), hence MathJax is not loaded and accordingly can't render the page.
(You can open the JavaScript console in the developer tools of your browser to see an error message about this.)
I am not sure if this is possible.
This is the name of the site:
www.mysite.com
and I created an html (named index.html) & saved it to the folder myfile which is a redirect to this site www.mysite.com/myfile
Now on the site, I have a content here that if you click on it, it will direct you to this:
www.mysite.com/documentation
Now the redirect html I made, I would like it to be redirected to the documentation
so that if you click on www.mysite.com/myfile - it will open the www.mysite.com/documentation but this documentation is not an html its inside the cms.
Is that possible?
Btw here is the html code I saved in the index.html. Do I have to insert the url here:
www.mysite.com/documentation?
CONSTRUCTION PAGE
Is this what you need?
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.mysite.com/documentation">
I have trouble understanding your question correctly. So I am unsure if this will help you.
Edit for valid html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Redirect</title>
<meta http-equiv="REFRESH" content="0; url=http://www.mysite.com/documentation" />
</head>
<body>
</body>
</html>
Use document type weblink on modx
As Gus suggested, use a weblink.
Create a new weblink with alias myfile, and the content should be a link to www.mysite.com/documentation.
Then if you visit www.mysite.com/myfile it will take you directly to www.mysite.com/documentation.
For more info: http://rtfm.modx.com/display/revolution20/Weblink
As the others have already said, a weblink in modX would be the way to go.
I answered this already in more detail in your other question with essentially the same topic.