I'm trying to wrap my head around how I can go into the Netlify CMS and be able to edit the home page texts using Hugo. Days of research is leading me nowhere since all documents are about doing blog posts.
Right now I have my Netlify config.yml in the static/admin and an index.html file in the layouts folder. What do I need to do to be able to go into the Netlify dashboard and edit fields which will change texts on home page?
If I were to make the index.html as a markdown file in the content folder, how can I pull that data within the index.md to the index.html that lives in the layout folder?
If netlifycms is already in the site and that site is on netlify, then the next step is to add your account as a user to the site.
Open the site in the app.netlify.com/sites
Click on the Identity tab
Invite users
Accept invitation
Open up YOURDOMAIN.COM/admin page
Netlify will prompt for a login
I've had the same problem figuring out how to do netlifycms. Instructions are generally weak on where one does what. Sometimes creating an account/password is also problematic. Good luck!
Your index.html would need to be something like:
{{ define "main" }}
<article>
<h1>{{.Title}}</h1>
{{.Content}}
<!-- any other homepage html -->
</article>
{{ end }}
And then that will be populated with the content of content/_index.md in the same way as any other content page.
---
title: My homepage
date: 2020-04-24T10:48:46.000Z
---
User-editable homepage content, easily managed with Netlify CMS
Contents for the home page has to be in content/_index.md (or _index.en.md for multilingual).
If your netlify-cms config for pages collection does not match this (for example if you keep your pages in content/pages/*.md), then you need a special collection configured with file: content/_index.md.
Related
I am using Docuapi theme with Hugo.
The docuapi theme combines all markdown files into one and generates a single HTML file.
I am using a Consent Management system to display a cookie consent banner.
The site is deployed using Cloudfront CDN.
I want to display the consent banner only for the requests coming from a certain region.
Is it possible to generate two different html files out of hugo for the same markdown files, with the same URL structure, and load them depending on which region the request is coming from?
I can setup my CDN to access different files based on the request.
Any ideas?
Yes, you can reuse content easily by doing this in your partial/layout/shortcode:
{{ with $.Site.GetPage 'yourmarkdownfile.md' }}{{ .Content }}{{ end }}
Can that be a starting point for a solution?
Problem
Using Grav CMS (v1.5.8) I want to redirect the user to other pages. The page is a multilanguage setup and depending on the selected language, the route to the the base / start pages for the languages are simply:
www.example.com/
and
www.example.com/en
From a page, let's say error, I want to direct the user back to this start page. I realised this using the following code in the twig template:
<a href="{{ uri.base }}/{{ grav.language.getLanguage }}" class="btn">
which generates the correct url including the language string maintaining the current language.
Question
Is there any Grav API that handles generating / getting the root including the current language in a short way?
I figured that the redirect in a multi-language environment works if you use simply
page.find('<the page you want to direct to>').url
So in case of my question, redirecting to home would be
<a href="{{ page.find('home') }}" class="btn">
which resolves with the current language string.
Right now im starting with my own personal blog, im doing this with Ghost, im developing my own theme based on casper, the blog is also my personal site, so i want to have a static page were i can upload all the reveal.js presentations that i've done (myblog.com/talks), like a list of presentations, right now i have my page-talks.hbs on my theme folder, but i wanna know of how can i upload all the static content from reveal.js, is there any way for doing this?
i've tried putting the html files directly inside the themes folder but i get 404 error when trying to access the url.
In ghost to make a static page, there are 2 important steps you should implement. First, you should create a static page on the admin panel (Click to "New Story"). After this, in the "Post Settings Menu" (by clicking on the gear icon in the top right corner) check the box to "Turn this into a static page". Hit 'Publish'.
Second, create a .hbs file manually in your theme folder with a prefix of "page-" and with the name (title) you choosed in the first step, like: page-your-choosed-name.hbs.
By now you should able to reach your static page, and you can easily fill in the hbs file with content.
Hope this helps!
I have a public internet site created in SharePoint 2010. I have uploaded an index.html web page to a Document Library, which I will call "abc." Here is what I want to happen:
www.website.com/abc >> should automatically direct to index.html in that library.
Instead, when I go to that URL, I am asked to log in. My usual login information that I use to edit the site, however, has no effect, and I am eventually just taken to blank white page.
If I type the full URL, www.website.com/abc/index.html, it goes to the correct page, so I know it has been published.
The index.html page is the only item in the document library.
The web address listed in the Document Library settings is http://www.website.com/abc/Forms/AllItems.aspx. I think this is what I need to change to get it to default to index.html. Anyone know how to do this?
Thanks.
Sharepoint document libraries can only have default views for their default pages. Can you create a view to make your changes there, or edit the default view?
If not, you could always edit the default view in Sharepoint Designer and put a redirect to your page, but that's kind of hackish.
We are creating a custom branded Master Page in SharePoint 2010. To make the page similar to a legacy page we have implemented an html based custom dropdown navigation menu we had in place directly on the Master Page (consisted of basic HTML elements ULs and LIs with A tags styled with a CSS class).
I assumed the links from the basic HTML on the page would be subject to Alternate Access Mappings currently in place, but it seems to not be the case. On a test page opened in 3 different URLs (http://sharepoint2010, http://sharepoint2010.mydomain.com, https://sharepoint2010.mydomain.com) the links from a WIKI page are modified as I expected, but the links from the Custom Navigation Menu (plain HTML on the Master Page) are not modified.
I can see where that would be useful... But is there a way that I can add links on the MasterPage in a way that SharePoint parses them first, making them subject to Alternate Access Mapping translation? I tried placing a link inside a SPLinkButton control, but it didn't achieve the desired behavior.
e.g.
<ul id="navmenu">
<li><SharePoint:SPLinkButton runat="server" NavigateUrl="http://sharepoint2010">sharepoint link</SharePoint:SPLinkButton></li>
<li>sharepoint2010</li>
<li>test</li>
</ul>
When I access the page via https://sharepoint2010.mydomain.com the links above are still http://sharepoint2010 rather than https://sharepoint2010.mydomain.com
Any thoughts?
Thanks,
Victor
EDIT (clarify):
I was planning on using relative links as a fallback. But for the purpose of what we are doing it would be more maintainable if we could keep the full links and use AAM.
I'm aware that standard relative links are a possibility. I was hoping to identify if there is a way to use AAM on Master Page content (or even on Content Retrieved from External Services down the road) by providing a specific link syntax, or control framework.
There is no need to re-insert the host name if your links are on the same domain and you're not using managed paths. Keeping your links relative will ensure that any bindings in IIS and AAM setup in SharePoint will work without any additional work.
Otherwise, I would heavily suggest to use the available ~sitecollection and ~site SPUrl token to retrieve the current site collection url or current web url. You need to wrap it in anything running server side as the expression will be handled ... server side.
eg:
<asp:Literal runat="server" Text="<% $SPUrl:~site/press-releases/ %>"/>
Hope it helped
When you use the NavigateUrl= attribute of the SPLinkButton, SharePoint renders a simple anchor with href= instead of regular PostBack JavaScript code. Alternate access mapping do not play a role here.
If its simply relative links you want, then leave out the dns entry altogether (ie the bit of the url you are switching with your AAM) and begin the url with a forward slash to make it relative. If this doesn't meet your needs, the way Sharepoint does it is with a relative url token. Have a look in v4.master for the tilda character followed by 'site' or 'sitecollection' which refers to the current web and site collection respectively. Copy this method. For more details, look at this link: http://msdn.microsoft.com/en-us/library/ms473643.aspx