Skip to content

Commit c6dbdde

Browse files
committed
fix hashpath prefix for docs/sitemap/etc
1 parent f8417b4 commit c6dbdde

5 files changed

Lines changed: 18 additions & 16 deletions

File tree

docs/spec/sitemapSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ describe('sitemap', function(){
1212
});
1313

1414
it('should render ngdoc url', function(){
15-
var map = new SiteMap([new Doc({name: 'a.b.c<>\'"&'})]);
15+
var map = new SiteMap([new Doc({section: 'foo', name: 'a.b.c<>\'"&'})]);
1616
expect(map.render()).toContain([
1717
' <url>',
18-
'<loc>http://docs.angularjs.org/#!a.b.c&lt;&gt;&apos;&quot;&amp;</loc>',
18+
'<loc>http://docs.angularjs.org/#!/foo/a.b.c&lt;&gt;&apos;&quot;&amp;</loc>',
1919
'<changefreq>weekly</changefreq>',
2020
'</url>'].join(''));
2121

docs/src/SiteMap.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ function SiteMap(docs){
1212
map.push('<?xml version="1.0" encoding="UTF-8"?>');
1313
map.push('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
1414
docs.forEach(function(doc){
15-
map.push(' <url><loc>http://docs.angularjs.org/#!' +
16-
encode(doc.name) + '</loc><changefreq>weekly</changefreq></url>');
15+
map.push(' <url><loc>http://docs.angularjs.org/#!/' +
16+
encode(doc.section) + '/' +
17+
encode(doc.name) +
18+
'</loc><changefreq>weekly</changefreq></url>');
1719
});
1820
map.push('</urlset>');
1921
map.push('');

docs/src/ngdoc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,9 @@ Doc.prototype = {
534534
function scenarios(docs){
535535
var specs = [];
536536
docs.forEach(function(doc){
537-
specs.push('describe("' + doc.id + '", function(){');
537+
specs.push('describe("' + doc.section + '/' + doc.id + '", function(){');
538538
specs.push(' beforeEach(function(){');
539-
specs.push(' browser().navigateTo("index.html#!' + doc.id + '");');
539+
specs.push(' browser().navigateTo("index.html#!/' + doc.section + '/' + doc.id + '");');
540540
specs.push(' });');
541541
specs.push('');
542542
doc.scenarios.forEach(function(scenario){

docs/src/templates/docs.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ function DocsController($location, $browser, $window) {
66
this.$location = $location;
77

88
if (!HAS_HASH.test($location.href)) {
9-
$location.hashPath = '!api/';
9+
$location.hashPath = '!/api';
1010
}
1111

1212
this.$watch('$location.hashPath', function(hashPath) {
1313
if (hashPath.match(/^!/)) {
1414
var parts = hashPath.substring(1).split('/');
15-
self.sectionId = parts[0];
16-
self.partialId = parts[1] || 'index';
15+
self.sectionId = parts[1];
16+
self.partialId = parts[2] || 'index';
1717
self.pages = angular.Array.filter(NG_PAGES, {section:self.sectionId});
1818
self.partialTitle = (angular.Array.filter(self.pages, function(doc){return doc.id == self.partialId;})[0]||{}).name;
1919
}
2020
});
2121

2222
this.getUrl = function(page){
23-
return '#!' + page.section + '/' + page.id;
23+
return '#!/' + page.section + '/' + page.id;
2424
};
2525

2626
this.getCurrentPartial = function(){
@@ -48,7 +48,7 @@ function DocsController($location, $browser, $window) {
4848
this.afterPartialLoaded = function() {
4949
SyntaxHighlighter.highlight();
5050
$window.scrollTo(0,0);
51-
$window._gaq.push(['_trackPageview', $location.hashPath.replace('!', '/')]);
51+
$window._gaq.push(['_trackPageview', $location.hashPath.substr(1)]);
5252
};
5353

5454
this.getFeedbackUrl = function() {

docs/src/templates/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151

5252
<ul id="navbar">
5353
<li><a href="http://angularjs.org/">&lt;angular/&gt;</a></li>
54-
<li><a href="#!guide" ng:class="selectedSection('guide')">Developer Guide</a></li>
55-
<li><a href="#!api" ng:class="selectedSection('api')">API Reference</a></li>
56-
<li><a href="#!cookbook" ng:class="selectedSection('cookbook')">Examples</a></li>
57-
<li><a href="#!misc/started" ng:class="selectedSection('intro')">Getting Started</a></li>
58-
<li><a href="#!tutorial" ng:class="selectedSection('tutorial')">Tutorial</a></li>
54+
<li><a href="#!/guide" ng:class="selectedSection('guide')">Developer Guide</a></li>
55+
<li><a href="#!/api" ng:class="selectedSection('api')">API Reference</a></li>
56+
<li><a href="#!/cookbook" ng:class="selectedSection('cookbook')">Examples</a></li>
57+
<li><a href="#!/misc/started" ng:class="selectedSection('misc')">Getting Started</a></li>
58+
<li><a href="#!/tutorial" ng:class="selectedSection('tutorial')">Tutorial</a></li>
5959
</ul>
6060

6161
<div id="sidebar">

0 commit comments

Comments
 (0)